From aed32afd0f40ec7636fceb00fe0e95cf164a7bd8 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 2 Oct 2019 10:41:00 +0200 Subject: [PATCH] Revert copy-paste property editors, will move to a diff branch --- .../PropertyEditors/DataEditorAttribute.cs | 5 -- .../PropertyEditors/DataValueEditor.cs | 7 -- .../PropertyEditors/IDataValueEditor.cs | 5 -- .../property/umbproperty.directive.js | 4 - .../src/less/property-editors.less | 9 --- .../components/property/umb-property.html | 3 - .../nestedcontent/nestedcontent.controller.js | 73 +++---------------- src/Umbraco.Web.UI/Umbraco/config/lang/en.xml | 1 - .../Umbraco/config/lang/en_us.xml | 1 - .../ContentEditing/ContentPropertyDisplay.cs | 3 - .../Mapping/ContentPropertyDisplayMapper.cs | 1 - .../NestedContentPropertyEditor.cs | 3 +- 12 files changed, 10 insertions(+), 105 deletions(-) diff --git a/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs b/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs index 2639b627a9..821f06513e 100644 --- a/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs +++ b/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs @@ -111,11 +111,6 @@ namespace Umbraco.Core.PropertyEditors /// public bool HideLabel { get; set; } - /// - /// Gets or sets a value indicating whether the editor value can be copied - /// - public bool CanCopy { get; set; } - /// /// Gets or sets an optional icon. /// diff --git a/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs b/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs index 2f215c6032..c4380f032c 100644 --- a/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs @@ -57,7 +57,6 @@ namespace Umbraco.Core.PropertyEditors View = view; ValueType = attribute.ValueType; HideLabel = attribute.HideLabel; - CanCopy = attribute.CanCopy; } /// @@ -134,12 +133,6 @@ namespace Umbraco.Core.PropertyEditors [JsonProperty("hideLabel")] public bool HideLabel { get; set; } - /// - /// If this is true then the editor value can be copied - /// - [JsonProperty("canCopy")] - public bool CanCopy { get; set; } - /// /// Set this to true if the property editor is for display purposes only /// diff --git a/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs b/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs index 18670ccf4f..cb68531cc7 100644 --- a/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs @@ -34,11 +34,6 @@ namespace Umbraco.Core.PropertyEditors /// bool HideLabel { get; } - /// - /// Gets a value indicating whether the value can be copied - /// - bool CanCopy { get; } - /// /// Validates a property value. /// diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js index 1e4c810fec..302378b8c0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/property/umbproperty.directive.js @@ -32,10 +32,6 @@ angular.module("umbraco.directives") self.setPropertyError = function (errorMsg) { $scope.property.propertyErrorMessage = errorMsg; }; - - $scope.onCopy = function () { - $scope.$broadcast("propertyCopy"); - } } }; }); diff --git a/src/Umbraco.Web.UI.Client/src/less/property-editors.less b/src/Umbraco.Web.UI.Client/src/less/property-editors.less index 186ac42f4a..6c5e8335ac 100644 --- a/src/Umbraco.Web.UI.Client/src/less/property-editors.less +++ b/src/Umbraco.Web.UI.Client/src/less/property-editors.less @@ -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 diff --git a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html index 7f48ca250d..9d2588484c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/property/umb-property.html @@ -17,9 +17,6 @@ * - - - diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js index ffc9f13286..536169778c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js @@ -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(); }); } diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index 4a49a94823..7f15cab2c2 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -275,7 +275,6 @@ Are you sure you want to delete this item? Property %0% uses editor %1% which is not supported by Nested Content. No content types are configured for this property. - %0% from %1% Add another text box Remove this text box Content root diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index faf336d94d..08c8829a73 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -279,7 +279,6 @@ Are you sure you want to delete this item? Property %0% uses editor %1% which is not supported by Nested Content. No content types are configured for this property. - %0% from %1% Add another text box Remove this text box Content root diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs index add557c8fc..39a4718dd0 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentPropertyDisplay.cs @@ -33,9 +33,6 @@ namespace Umbraco.Web.Models.ContentEditing [DataMember(Name = "hideLabel")] public bool HideLabel { get; set; } - [DataMember(Name = "canCopy")] - public bool CanCopy { get; set; } - [DataMember(Name = "validation")] public PropertyTypeValidation Validation { get; set; } diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs index 7194767ce4..f68c5d8b44 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayMapper.cs @@ -39,7 +39,6 @@ namespace Umbraco.Web.Models.Mapping dest.Description = originalProp.PropertyType.Description; dest.Label = originalProp.PropertyType.Name; dest.HideLabel = valEditor.HideLabel; - dest.CanCopy = valEditor.CanCopy; //add the validation information dest.Validation.Mandatory = originalProp.PropertyType.Mandatory; diff --git a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs index fb17e97519..7e91a3af79 100644 --- a/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/NestedContentPropertyEditor.cs @@ -24,8 +24,7 @@ namespace Umbraco.Web.PropertyEditors "nestedcontent", ValueType = ValueTypes.Json, Group = Constants.PropertyEditors.Groups.Lists, - Icon = "icon-thumbnail-list", - CanCopy = true)] + Icon = "icon-thumbnail-list")] public class NestedContentPropertyEditor : DataEditor { private readonly Lazy _propertyEditors;