From ca2eaeefdc12d7df1b576e46c7cbcb785c978e8f Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Tue, 18 Jul 2023 14:00:31 +0400 Subject: [PATCH] Init canvas model in postLoad --- src/canvas/index.ts | 2 +- src/editor/model/Editor.ts | 3 ++- src/pages/index.ts | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/canvas/index.ts b/src/canvas/index.ts index ef0cf251f..845cc0f7d 100644 --- a/src/canvas/index.ts +++ b/src/canvas/index.ts @@ -95,7 +95,7 @@ export default class CanvasModule extends Module { return this; } - onLoad() { + postLoad() { this.model.init(); } diff --git a/src/editor/model/Editor.ts b/src/editor/model/Editor.ts index 74f7a8006..3179dddf4 100644 --- a/src/editor/model/Editor.ts +++ b/src/editor/model/Editor.ts @@ -348,7 +348,8 @@ export default class EditorModel extends Model { undoManager: false, }); // We only need to load a few modules - ['PageManager', 'Canvas'].forEach(key => shallow.get(key).onLoad()); + shallow.Pages.onLoad(); + shallow.Canvas.postLoad(); this.set('shallow', shallow); } diff --git a/src/pages/index.ts b/src/pages/index.ts index e81850c97..9268b05ec 100644 --- a/src/pages/index.ts +++ b/src/pages/index.ts @@ -135,9 +135,10 @@ export default class PageManager extends ItemManagerModule new Page(page, { em: this.em, config: this.config })) || [], opt); + const configPages = config.pages?.map(page => new Page(page, { em, config })) || []; + pages.add(configPages, opt); const mainPage = !pages.length ? this.add({ type: typeMain }, opt) : this.getMain(); mainPage && this.select(mainPage, opt); }