From be7d243efc7321dde0c3da14fe30646fc4e0efd8 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 21 Sep 2017 15:35:04 +0200 Subject: [PATCH] Add `component:selected` event --- src/commands/index.js | 1 - src/editor/index.js | 1 + src/editor/model/Editor.js | 6 ++++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/commands/index.js b/src/commands/index.js index c9218e231..e5d5dfab3 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -117,7 +117,6 @@ module.exports = () => { ed.select(null); sel.destroy(); - ed.trigger('change:canvasOffset'); }, }; diff --git a/src/editor/index.js b/src/editor/index.js index ed6e7d4cd..79cd820c0 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -37,6 +37,7 @@ * * `component:update:{propertyName}` - Listen any property change * * `component:styleUpdate` - Triggered when the style of the component is updated * * `component:styleUpdate:{propertyName}` - Listen for a specific style property change + * * `component:selected` - New component selected * * `asset:add` - New asset added * * `asset:remove` - Asset removed * * `asset:upload:start` - Before the upload is started diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index bcfaf96ad..72b2a0066 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -291,10 +291,12 @@ module.exports = Backbone.Model.extend({ * @private * */ componentSelected(model, val, options) { - if(!this.get('selectedComponent')) + if (!this.get('selectedComponent')) { this.trigger('deselect-comp'); - else + } else { this.trigger('select-comp',[model,val,options]); + this.trigger('component:selected', arguments); + } }, /**