widget: amend 1bfc558f83 & 857e0408be to only affect clones and fix circular loop regression

This commit is contained in:
jean-emmanuel 2025-01-22 15:38:36 +01:00
parent 67bb888a45
commit b3b08c3af5
2 changed files with 8 additions and 3 deletions

View file

@ -978,7 +978,7 @@ class Widget extends EventEmitter {
// 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', {
widgetManager.trigger('prop-changed-maybe', {
id: this.getProp('id'),
props: unNotified,
widget: this,

View file

@ -95,7 +95,7 @@ class Clone extends Container() {
}, {context: this})
widgetManager.on('prop-changed', (e)=>{
var onPropChanged = (e)=>{
// watch for prop changes initiated by the editor
// Other changes (from advanced syntaxes) are already
// handled by standard widget mechanicsé
@ -109,7 +109,12 @@ class Clone extends Container() {
}
}, {context: this})
}
widgetManager.on('prop-changed', onPropChanged, {context: this})
// see common/widget.js @ updateProps()
widgetManager.on('prop-changed-maybe', onPropChanged, {context: this})
this.on('widget-created', (e)=>{