Browse Source

Add destroy method to DomComponents module

pull/3147/head
Artur Arseniev 6 years ago
parent
commit
a0fbe75391
  1. 19
      src/dom_components/index.js
  2. 2
      src/editor/model/Editor.js

19
src/dom_components/index.js

@ -344,12 +344,13 @@ export default () => {
const handleChanges = this.handleChanges.bind(this);
const handleRemoves = this.handleRemoves.bind(this);
um.add(coll);
[[coll, 'add', handleChanges], [coll, 'remove', handleRemoves]].forEach(
els => {
em.stopListening(els[0], els[1], els[2]);
em.listenTo(els[0], els[1], els[2]);
}
);
[
[coll, 'add', handleChanges],
[coll, 'remove', handleRemoves]
].forEach(els => {
em.stopListening(els[0], els[1], els[2]);
em.listenTo(els[0], els[1], els[2]);
});
}
},
@ -733,6 +734,12 @@ export default () => {
allById() {
return componentsById;
},
destroy() {
this.clear();
componentView.remove();
[c, em, componentsById, component, componentView].forEach(i => (i = {}));
}
};
};

2
src/editor/model/Editor.js

@ -766,7 +766,7 @@ export default Backbone.Model.extend({
DeviceManager
} = this.attributes;
this.stopDefault();
DomComponents.clear();
DomComponents.destroy();
CssComposer.destroy();
UndoManager.clear().removeAll();
Panels.getPanels().reset();

Loading…
Cancel
Save