From f8fbfcc8a145d62a4f30b5bec015abe03fa343ae Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sat, 14 Nov 2020 15:28:53 +0100 Subject: [PATCH] Add destroy method to I18n module --- src/editor/model/Editor.js | 4 +++- src/i18n/index.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 5cd889028..bd444b142 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -763,7 +763,8 @@ export default Backbone.Model.extend({ BlockManager, CodeManager, Commands, - DeviceManager + DeviceManager, + I18n } = this.attributes; this.stopDefault(); DomComponents.destroy(); @@ -779,6 +780,7 @@ export default Backbone.Model.extend({ CodeManager.destroy(); Commands.destroy(); DeviceManager.destroy(); + I18n.destroy(); this.view.remove(); this.stopListening(); this.clear({ silent: true }); diff --git a/src/i18n/index.js b/src/i18n/index.js index 0225ea424..66a10ada2 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -242,6 +242,11 @@ export default () => { _debug(str, opts = {}) { const { em, config } = this; (opts.debug || config.debug) && em && em.logWarning(str); + }, + + destroy() { + this.config = config; + this.em = {}; } }; };