From 59a46495284d4f056fb6dbbc56af2bf46004dc30 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 29 Jan 2025 10:29:58 +0100 Subject: [PATCH] Do not allow editing read-only properties by clicking their labels (#18152) * Do not allow editing read-only properties by clicking their labels * Simplify the fix :) * Fix linting issue --- .../components/content/umbtabbedcontent.directive.js | 4 ++++ .../components/property/umbproperty.directive.js | 7 ++++--- .../views/components/content/umb-tabbed-content.html | 10 ++++++---- .../src/views/components/property/umb-property.html | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js index e76da32a54..fe16d1cf9d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbtabbedcontent.directive.js @@ -218,6 +218,10 @@ return !canEditCulture || !canEditSegment; } + + $scope.isPreview = function(property) { + return ((property.readonly || !$scope.allowUpdate) && !property.supportsReadOnly) || ($scope.propertyEditorDisabled(property) && $scope.allowUpdate); + } } var directive = { 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 11efb4b811..073df54a7e 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 @@ -25,11 +25,12 @@ propertyAlias: "@", showInherit: "<", inheritsFrom: "<", - hideLabel: " 1 && property.variation !== 'CultureAndSegment'" - inherits-from="defaultVariant.displayName"> + inherits-from="defaultVariant.displayName" + preview="isPreview(property)"> @@ -49,12 +50,13 @@ property="property" node="contentNodeModel" show-inherit="contentNodeModel.variants.length > 1 && property.variation !== 'CultureAndSegment'" - inherits-from="defaultVariant.displayName"> + inherits-from="defaultVariant.displayName" + preview="isPreview(property)"> 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 e3a65a215b..e4166e8e98 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 @@ -9,7 +9,7 @@
- +