Browse Source

Add destroy method to I18n module

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

4
src/editor/model/Editor.js

@ -763,7 +763,8 @@ export default Backbone.Model.extend({
BlockManager, BlockManager,
CodeManager, CodeManager,
Commands, Commands,
DeviceManager DeviceManager,
I18n
} = this.attributes; } = this.attributes;
this.stopDefault(); this.stopDefault();
DomComponents.destroy(); DomComponents.destroy();
@ -779,6 +780,7 @@ export default Backbone.Model.extend({
CodeManager.destroy(); CodeManager.destroy();
Commands.destroy(); Commands.destroy();
DeviceManager.destroy(); DeviceManager.destroy();
I18n.destroy();
this.view.remove(); this.view.remove();
this.stopListening(); this.stopListening();
this.clear({ silent: true }); this.clear({ silent: true });

5
src/i18n/index.js

@ -242,6 +242,11 @@ export default () => {
_debug(str, opts = {}) { _debug(str, opts = {}) {
const { em, config } = this; const { em, config } = this;
(opts.debug || config.debug) && em && em.logWarning(str); (opts.debug || config.debug) && em && em.logWarning(str);
},
destroy() {
this.config = config;
this.em = {};
} }
}; };
}; };

Loading…
Cancel
Save