From 857e0408be41fa846fb85e3ea87e134a79979f18 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 11 Jan 2025 14:48:17 +0100 Subject: [PATCH] editor: rewrite 1bfc558f83deef094b4d1bd2e986f4693c4e55e8 --- src/client/widgets/common/widget.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 06dee133..1b4e05f4 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -408,6 +408,7 @@ class Widget extends EventEmitter { || propNames.some(n => linkedProps.includes(n)) ) { this.createPropsCache() + return true } } @@ -915,9 +916,7 @@ class Widget extends EventEmitter { let propValue = this.resolveProp(propName, undefined, false), oldPropValue = this.getProp(propName) - if (!deepEqual(oldPropValue, propValue) || (options && options.fromEditor)) { - // forced if initiated by the editor to make sure advanced syntax changes don't go unnoticed by clone - // (a VAR{} may be renamed without its return value to change immediately) + if (!deepEqual(oldPropValue, propValue)) { if (!this.isDynamicProp(propName)) { @@ -972,7 +971,21 @@ class Widget extends EventEmitter { } if (options && options.fromEditor) { - this.checkLinkedProps(propNames) + + // update advanced syntax bindings if its an edition + if (this.checkLinkedProps(propNames)) { + + // emit prop-changed event if not already + // to make sure an advanced syntax changes don't go unnoticed by clone + var unNotified = propNames.filter(n => !changedProps.includes(n)) + widgetManager.trigger('prop-changed', { + id: this.getProp('id'), + props: unNotified, + widget: this, + options: options + }) + } + } }