Browse Source

Add destroy method to Commands module

pull/3147/head
Artur Arseniev 5 years ago
parent
commit
e0295270e0
  1. 4
      src/commands/index.js
  2. 4
      src/editor/model/Editor.js

4
src/commands/index.js

@ -424,6 +424,10 @@ export default () => {
if (!command.stop) command.noStop = 1;
const cmd = CommandAbstract.extend(command);
return new cmd(c);
},
destroy() {
[em, c, commands, defaultCommands, active].forEach(i => (i = {}));
}
};
};

4
src/editor/model/Editor.js

@ -761,7 +761,8 @@ export default Backbone.Model.extend({
LayerManager,
AssetManager,
BlockManager,
CodeManager
CodeManager,
Commands
} = this.attributes;
this.stopDefault();
DomComponents.clear();
@ -775,6 +776,7 @@ export default Backbone.Model.extend({
AssetManager.destroy();
BlockManager.destroy();
CodeManager.destroy();
Commands.destroy();
this.view.remove();
this.stopListening();
this.clear({ silent: true });

Loading…
Cancel
Save