Skip to content

Commit

Permalink
client: Improve mind map saving & centering
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Sep 1, 2024
1 parent 1b08487 commit 6c54f3c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/public/app/widgets/type_widgets/mind_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,19 @@ export default class MindMapWidget extends TypeWidget {
this.#initLibrary();
}

await this.#loadData(note);
await this.#loadData(note);
}

cleanup() {
this.triggeredByUserOperation = false;
}

async #loadData(note) {
const blob = await note.getBlob();
const content = blob.getJsonContent();
const content = blob.getJsonContent() || MindElixir.new();

this.mind.refresh(content);
this.mind.toCenter();
}

#initLibrary() {
Expand All @@ -63,7 +65,7 @@ export default class MindMapWidget extends TypeWidget {
mind.init(MindElixir.new());
mind.bus.addListener("operation", (operation) => {
this.triggeredByUserOperation = true;
if (operation.name !== "startEdit") {
if (operation.name !== "beginEdit") {
this.spacedUpdate.scheduleUpdate();
}
});
Expand Down

0 comments on commit 6c54f3c

Please sign in to comment.