From f6298b939eebc661f33c069fd216973e8a0279ec Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 17 Nov 2019 23:13:20 +0100 Subject: [PATCH] Load DomComponents before CSSComposer to avoid removing ID rules --- src/dom_components/index.js | 2 ++ src/editor/model/Editor.js | 10 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dom_components/index.js b/src/dom_components/index.js index 9cade9f70..5259166c1 100644 --- a/src/dom_components/index.js +++ b/src/dom_components/index.js @@ -389,6 +389,8 @@ export default () => { const isObj = result && result.constructor === Object; if ((result && result.length) || isObj) { + this.clear(); + // If the result is an object I consider it the wrapper if (isObj) { this.getWrapper().set(result); diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 279bf0d5d..818c51871 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -200,9 +200,9 @@ export default Backbone.Model.extend({ if (Mod.storageKey && Mod.store && Mod.load && sm) { cfg.stm = sm; - const storables = this.get('storables'); - storables.push(Mod); - this.set('storables', storables); + // DomComponents should be load before CSS Composer + const mth = name == 'domComponents' ? 'unshift' : 'push'; + this.get('storables')[mth](Mod); } cfg.em = this; @@ -508,9 +508,7 @@ export default Backbone.Model.extend({ */ load(clb = null) { this.getCacheLoad(1, res => { - const storables = this.get('storables'); - storables.forEach(module => module.clear && module.clear()); - storables.forEach(module => module.load(res)); + this.get('storables').forEach(module => module.load(res)); clb && clb(res); }); },