Browse Source

Clear modules before project load

pull/4267/head
Artur Arseniev 4 years ago
parent
commit
13cc982fe7
  1. 5
      src/dom_components/index.js
  2. 8
      src/editor/model/Editor.js

5
src/dom_components/index.js

@ -400,9 +400,8 @@ export default () => {
* @return {this}
*/
clear(opts = {}) {
this.getComponents()
.map(i => i)
.forEach(i => i.remove(opts));
const components = this.getComponents();
components?.filter(Boolean).forEach(i => i.remove(opts));
return this;
},

8
src/editor/model/Editor.js

@ -225,9 +225,7 @@ export default class EditorModel extends Model {
}
if (Mod.storageKey && Mod.store && Mod.load) {
// Components should be loaded before CSS due to reset
const mth = ['domComponents', 'pageManager'].indexOf(name) >= 0 ? 'unshift' : 'push';
this.get('storables')[mth](Mod);
this.get('storables').push(Mod);
}
cfg.em = this;
@ -654,7 +652,9 @@ export default class EditorModel extends Model {
}
loadData(data = {}) {
this.get('storables').forEach(module => module.load(data));
const storableModules = this.get('storables');
storableModules.forEach(module => module.clear());
storableModules.forEach(module => module.load(data));
return data;
}

Loading…
Cancel
Save