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

@@ -111,11 +111,6 @@ namespace Umbraco.Core.PropertyEditors
/// </summary>
public bool HideLabel { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the editor value can be copied
/// </summary>
public bool CanCopy { get; set; }
/// <summary>
/// Gets or sets an optional icon.
/// </summary>

View File

@@ -57,7 +57,6 @@ namespace Umbraco.Core.PropertyEditors
View = view;
ValueType = attribute.ValueType;
HideLabel = attribute.HideLabel;
CanCopy = attribute.CanCopy;
}
/// <summary>
@@ -134,12 +133,6 @@ namespace Umbraco.Core.PropertyEditors
[JsonProperty("hideLabel")]
public bool HideLabel { get; set; }
/// <summary>
/// If this is true then the editor value can be copied
/// </summary>
[JsonProperty("canCopy")]
public bool CanCopy { get; set; }
/// <summary>
/// Set this to true if the property editor is for display purposes only
/// </summary>

View File

@@ -34,11 +34,6 @@ namespace Umbraco.Core.PropertyEditors
/// </summary>
bool HideLabel { get; }
/// <summary>
/// Gets a value indicating whether the value can be copied
/// </summary>
bool CanCopy { get; }
/// <summary>
/// Validates a property value.
/// </summary>

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();
});
}

View File

@@ -275,7 +275,6 @@
<key alias="nestedContentDeleteItem">Are you sure you want to delete this item?</key>
<key alias="nestedContentEditorNotSupported">Property %0% uses editor %1% which is not supported by Nested Content.</key>
<key alias="nestedContentNoContentTypes">No content types are configured for this property.</key>
<key alias="nestedContentCopyAllItemsName">%0% from %1%</key>
<key alias="addTextBox">Add another text box</key>
<key alias="removeTextBox">Remove this text box</key>
<key alias="contentRoot">Content root</key>

View File

@@ -279,7 +279,6 @@
<key alias="nestedContentDeleteItem">Are you sure you want to delete this item?</key>
<key alias="nestedContentEditorNotSupported">Property %0% uses editor %1% which is not supported by Nested Content.</key>
<key alias="nestedContentNoContentTypes">No content types are configured for this property.</key>
<key alias="nestedContentCopyAllItemsName">%0% from %1%</key>
<key alias="addTextBox">Add another text box</key>
<key alias="removeTextBox">Remove this text box</key>
<key alias="contentRoot">Content root</key>

View File

@@ -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; }

View File

@@ -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;

View File

@@ -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<PropertyEditorCollection> _propertyEditors;