From fb0dda982f75e969418f473b2b688cff558efa9d Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 19 Jan 2025 23:30:07 +0200 Subject: [PATCH] fix(mindmap): restore direction --- src/public/app/widgets/type_widgets/mind_map.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/public/app/widgets/type_widgets/mind_map.ts b/src/public/app/widgets/type_widgets/mind_map.ts index 3bd72836a..ef8fdaf27 100644 --- a/src/public/app/widgets/type_widgets/mind_map.ts +++ b/src/public/app/widgets/type_widgets/mind_map.ts @@ -179,7 +179,6 @@ export default class MindMapWidget extends TypeWidget { return; } - this.#initLibrary(); await this.#loadData(note); } @@ -191,16 +190,18 @@ export default class MindMapWidget extends TypeWidget { const blob = await note.getBlob(); const content = blob?.getJsonContent() || MindElixir.new(NEW_TOPIC_NAME); - if (this.mind) { - this.mind.refresh(content); - this.mind.toCenter(); + if (!this.mind) { + this.#initLibrary(content.direction ?? MindElixir.LEFT); } + + this.mind.refresh(content); + this.mind.toCenter(); } - #initLibrary() { + #initLibrary(direction: unknown) { const mind = new MindElixir({ el: this.$content[0], - direction: MindElixir.LEFT + direction }); mind.install(nodeMenu);