Revert copy-paste property editors, will move to a diff branch

This commit is contained in:
Shannon
2019-10-02 10:41:00 +02:00
parent 1512800639
commit aed32afd0f
12 changed files with 10 additions and 105 deletions

View File

@@ -32,10 +32,6 @@ angular.module("umbraco.directives")
self.setPropertyError = function (errorMsg) {
$scope.property.propertyErrorMessage = errorMsg;
};
$scope.onCopy = function () {
$scope.$broadcast("propertyCopy");
}
}
};
});

View File

@@ -57,16 +57,7 @@
border-radius: 3px;
}
.umb-property .umb-property__copy {
font-size: 16px;
padding: 4px;
line-height: 10px;
&:hover {
color: @ui-option-type-hover;
text-decoration: none;
}
}
//
// Content picker

View File

@@ -17,9 +17,6 @@
<span ng-if="property.validation.mandatory">
<strong class="umb-control-required">*</strong>
</span>
<a class="icon-documents umb-property__copy" ng-show="!showInherit && property.canCopy" ng-click="onCopy()" prevent-default></a>
<small ng-bind-html="property.description | preserveNewLineInHtml"></small>
</label>

View File

@@ -108,9 +108,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
"clipboardService",
"eventsService",
"overlayService",
"$routeParams",
"editorState",
function ($scope, $interpolate, $filter, $timeout, contentResource, localizationService, iconHelper, clipboardService, eventsService, overlayService, $routeParams, editorState) {
var contentTypeAliases = [];
@@ -177,15 +175,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
view: "itempicker",
event: $event,
clickPasteItem: function(item) {
if (item.alias === "nc_pasteAllItems") {
_.each(item.data, function (node) {
delete node.$$hashKey;
$scope.pasteFromClipboard(node, false);
});
} else {
$scope.pasteFromClipboard(item.data, true);
}
$scope.pasteFromClipboard(item.data);
$scope.overlayMenu.show = false;
$scope.overlayMenu = null;
},
@@ -219,20 +209,6 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
$scope.overlayMenu.size = $scope.overlayMenu.availableItems.length > 6 ? "medium" : "small";
$scope.overlayMenu.pasteItems = [];
var nestedContentForPaste = clipboardService.retriveDataOfType("nestedContent", ["nc_copyOfAllItems"]);
_.each(nestedContentForPaste, function (nestedContent) {
if (_.every(nestedContent.nodes,
function(node) {
return contentTypeAliases.indexOf(node.contentTypeAlias) >= 0;
})) {
$scope.overlayMenu.pasteItems.push({
alias: "nc_pasteAllItems",
name: nestedContent.name, // source property name
data: nestedContent.nodes, // all items from source property
icon: "icon-bulleted-list"
});
}
});
var availableNodesForPaste = clipboardService.retriveDataOfType("elementType", contentTypeAliases);
_.each(availableNodesForPaste, function (node) {
$scope.overlayMenu.pasteItems.push({
@@ -249,7 +225,6 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
$event.stopPropagation();
$event.preventDefault();
clipboardService.clearEntriesOfType("elementType", contentTypeAliases);
clipboardService.clearEntriesOfType("nestedContent", ["nc_copyOfAllItems"]);
$scope.overlayMenu.pasteItems = [];// This dialog is not connected via the clipboardService events, so we need to update manually.
};
@@ -414,27 +389,8 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
clipboardService.copy("elementType", node.contentTypeAlias, node);
$event.stopPropagation();
}
$scope.clickCopyAll = function () {
syncCurrentNode();
var culture = $routeParams.cculture ? $routeParams.cculture : $routeParams.mculture;
var activeVariant = _.find(editorState.current.variants, function (v) {
return !v.language || v.language.culture === culture;
});
localizationService.localize("content_nestedContentCopyAllItemsName", [$scope.model.label, activeVariant.name]).then(function(data) {
var model = {
nodes: $scope.nodes,
key: "nc_" + $scope.model.alias,
name: data
};
clipboardService.copy("nestedContent", "nc_copyOfAllItems", model);
});
}
$scope.pasteFromClipboard = function(newNode, setCurrentNode) {
$scope.pasteFromClipboard = function(newNode) {
if (newNode === undefined) {
return;
@@ -445,14 +401,9 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
$scope.nodes.push(newNode);
$scope.setDirty();
if (setCurrentNode) {
$scope.currentNode = newNode;
}
else {
updateModel();
}
//updateModel();// done by setting current node...
$scope.currentNode = newNode;
}
function checkAbilityToPasteContent() {
@@ -624,18 +575,12 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop
$scope.realCurrentNode = newVal;
});
var unsubscribe = [];
unsubscribe.push($scope.$on("formSubmitting", function (ev, args) {
var unsubscribe = $scope.$on("formSubmitting", function (ev, args) {
updateModel();
}));
unsubscribe.push($scope.$on("propertyCopy", function (ev, args) {
$scope.clickCopyAll();
}));
});
$scope.$on("$destroy", function () {
for (var u in unsubscribe) {
unsubscribe[u]();
}
unsubscribe();
});
}