From 84dc7e3275e51bd73b186b41bf4ff9f7840fa38c Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 30 Dec 2020 19:22:18 +0100 Subject: [PATCH] Adjust editor listeners in PropertyView. Fixes #3197 --- src/style_manager/view/PropertyView.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/style_manager/view/PropertyView.js b/src/style_manager/view/PropertyView.js index a6d672e89..d693b6246 100644 --- a/src/style_manager/view/PropertyView.js +++ b/src/style_manager/view/PropertyView.js @@ -66,16 +66,25 @@ export default Backbone.View.extend({ model.set('value', model.getDefaultValue()); } - em && em.on(`update:component:style:${this.property}`, this.targetUpdated); - //em && em.on(`styleable:change:${this.property}`, this.targetUpdated); + if (em) { + this.listenTo( + em, + `update:component:style:${this.property}`, + this.targetUpdated + ); + //this.listenTo(em, `styleable:change:${this.property}`, this.targetUpdated); - // Listening to changes of properties in this.requires, so that styleable - // changes based on other properties are propagated - const requires = model.get('requires'); - requires && + // Listening to changes of properties in this.requires, so that styleable + // changes based on other properties are propagated + const requires = model.get('requires') || {}; Object.keys(requires).forEach(property => { - em && em.on(`component:styleUpdate:${property}`, this.targetUpdated); + this.listenTo( + em, + `component:styleUpdate:${property}`, + this.targetUpdated + ); }); + } this.listenTo(this.propTarget, 'update', this.targetUpdated); this.listenTo(model, 'destroy remove', this.remove);