Skip to content

Commit

Permalink
Properly remove editor toolbars when a Component is removed. Fixes Gr…
Browse files Browse the repository at this point in the history
  • Loading branch information
artf authored and vijayshukla30 committed Apr 5, 2021
1 parent fd8eeac commit c2e116e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/view/SelectComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default {
};
methods[method](window, 'resize', this.onFrameUpdated);
methods[method](listenToEl, 'scroll', this.onContainerChange);
em[method]('component:toggled', this.onSelect, this);
em[method]('component:toggled component:remove', this.onSelect, this);
em[method]('change:componentHovered', this.onHovered, this);
em[method](
'component:resize component:styleUpdate component:input',
Expand Down
1 change: 1 addition & 0 deletions src/dom_components/model/Components.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default Backbone.Collection.extend({
const optStyle = { target: removed };
hasSign && cm.run('core:component-style-clear', optStyle);
removed.removed();
removed.trigger('removed');
em.trigger('component:remove', removed);
}

Expand Down
3 changes: 2 additions & 1 deletion src/dom_components/view/ComponentTextView.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default ComponentView.extend({
* @param {Boolean} enable
*/
toggleEvents(enable) {
const { em } = this;
const { em, model } = this;
const mixins = { on, off };
const method = enable ? 'on' : 'off';
em.setEditing(enable);
Expand All @@ -175,6 +175,7 @@ export default ComponentView.extend({
mixins.off(elDocs, 'mousedown', this.disableEditing);
mixins[method](elDocs, 'mousedown', this.disableEditing);
em[method]('toolbar:run:before', this.disableEditing);
model[method]('removed', this.disableEditing);

// Avoid closing edit mode on component click
this.$el.off('mousedown', this.disablePropagation);
Expand Down

0 comments on commit c2e116e

Please sign in to comment.