From 4f6a073f796e708cf48583e13c8274976d2f9cfa Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Mon, 8 Nov 2021 11:22:35 +0100 Subject: [PATCH] Re-bind readonly property state after save --- .../services/contenteditinghelper.service.js | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index 8e3855cd20..fdf0838394 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -624,24 +624,29 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, editorSt var origProp = allOrigProps[k]; var alias = origProp.alias; var newProp = getNewProp(alias, allNewProps); - if (newProp && !_.isEqual(origProp.value, newProp.value)) { + if (newProp) { + // Always update readonly state + origProp.readonly = newProp.readonly; - //they have changed so set the origContent prop to the new one - var origVal = origProp.value; + // Check whether the value has changed and update accordingly + if (!_.isEqual(origProp.value, newProp.value)) { - origProp.value = newProp.value; + //they have changed so set the origContent prop to the new one + var origVal = origProp.value; - //instead of having a property editor $watch their expression to check if it has - // been updated, instead we'll check for the existence of a special method on their model - // and just call it. - if (Utilities.isFunction(origProp.onValueChanged)) { - //send the newVal + oldVal - origProp.onValueChanged(origProp.value, origVal); + origProp.value = newProp.value; + + //instead of having a property editor $watch their expression to check if it has + // been updated, instead we'll check for the existence of a special method on their model + // and just call it. + if (Utilities.isFunction(origProp.onValueChanged)) { + //send the newVal + oldVal + origProp.onValueChanged(origProp.value, origVal); + } + + changed.push(origProp); } - - changed.push(origProp); } - } }