NotSupported property editor, to be used when an editor is not supported in the given context.

This commit is contained in:
Niels Lyngsø
2020-04-01 13:44:56 +02:00
parent 8513e2b332
commit e20c7578f8
8 changed files with 46 additions and 1 deletions
@@ -145,6 +145,28 @@
}
/**
* Used to highlight unsupported properties for the user, changes unsupported properties into a unsupported-property.
*/
var notSupportedProperties = [
"Umbraco.Tags",
"Umbraco.UploadField",
"Umbraco.ImageCropper"
];
function replaceUnsupportedProperties(scaffold) {
scaffold.variants.forEach((variant) => {
variant.tabs.forEach((tab) => {
tab.properties.forEach((property) => {
if (notSupportedProperties.indexOf(property.editor) !== -1) {
property.view = "notsupported";
}
});
});
});
return scaffold;
}
/**
* @ngdoc factory
* @name umbraco.factory.BlockEditorModelObject
@@ -198,7 +220,7 @@
scaffoldAliases.forEach((elementTypeAlias => {
tasks.push(contentResource.getScaffold(-20, elementTypeAlias).then(scaffold => {
this.scaffolds.push(scaffold);
this.scaffolds.push(replaceUnsupportedProperties(scaffold));
}));
}));
@@ -200,6 +200,7 @@
// Property Editors
@import "../views/propertyeditors/blocklist/blocklist.component.less";
@import "../views/propertyeditors/blocklist/prevalue/blocklist.elementtypepicker.less";
@import "../views/propertyeditors/notsupported/notsupported.less";
// Utilities
@@ -0,0 +1,9 @@
angular.module('umbraco').controller("Umbraco.PropertyEditors.NotSupportedController",
function ($scope) {
var vm = this;
console.log($scope.umbProperty);
}
);
@@ -0,0 +1,3 @@
<div class="umb-property-editor umb-property-editor-notsupported" ng-controller="Umbraco.PropertyEditors.NotSupportedController as vm">
<localize key="errors_errorPropertyEditorNotSupportedInElementTypes" tokens="[model.label, model.editor]"></localize>
</div>
@@ -0,0 +1,7 @@
.umb-property-editor-notsupported {
background-color: @red;
color: white;
padding: 5px 10px;
width: auto;
border-radius: @baseBorderRadius * 2;
}
@@ -607,6 +607,7 @@
<key alias="tableColMergeLeft">Du skal stå til venstre for de 2 celler du ønsker at samle!</key>
<key alias="tableSplitNotSplittable">Du kan ikke opdele en celle, som ikke allerede er delt.</key>
<key alias="propertyHasErrors">Denne egenskab er ugyldig</key>
<key alias="errorPropertyEditorNotSupportedInElementTypes">Feltet %0% bruger editor %1% som ikke er supporteret for ElementTyper.</key>
</area>
<area alias="general">
<key alias="about">Om</key>
@@ -608,6 +608,7 @@
<key alias="errorMandatoryWithoutTab">%0% is a mandatory field</key>
<key alias="errorRegExp">%0% at %1% is not in a correct format</key>
<key alias="errorRegExpWithoutTab">%0% is not in a correct format</key>
<key alias="errorPropertyEditorNotSupportedInElementTypes">Property %0% uses editor %1% which is not supported in ElementTypes.</key>
</area>
<area alias="errors">
<key alias="receivedErrorFromServer">Received an error from the server</key>
@@ -625,6 +625,7 @@
<key alias="tableColMergeLeft">Please place cursor at the left of the two cells you wish to merge</key>
<key alias="tableSplitNotSplittable">You cannot split a cell that hasn't been merged.</key>
<key alias="propertyHasErrors">This property is invalid</key>
<key alias="errorPropertyEditorNotSupportedInElementTypes">Property %0% uses editor %1% which is not supported in ElementTypes.</key>
</area>
<area alias="general">
<key alias="options">Options</key>