client: Improve mind map saving & centering

This commit is contained in:
Elian Doran 2024-09-01 16:31:05 +03:00
parent 1b08487ee9
commit 6c54f3c804
No known key found for this signature in database

View File

@ -49,8 +49,10 @@ export default class MindMapWidget extends TypeWidget {
async #loadData(note) { async #loadData(note) {
const blob = await note.getBlob(); const blob = await note.getBlob();
const content = blob.getJsonContent(); const content = blob.getJsonContent() || MindElixir.new();
this.mind.refresh(content); this.mind.refresh(content);
this.mind.toCenter();
} }
#initLibrary() { #initLibrary() {
@ -63,7 +65,7 @@ export default class MindMapWidget extends TypeWidget {
mind.init(MindElixir.new()); mind.init(MindElixir.new());
mind.bus.addListener("operation", (operation) => { mind.bus.addListener("operation", (operation) => {
this.triggeredByUserOperation = true; this.triggeredByUserOperation = true;
if (operation.name !== "startEdit") { if (operation.name !== "beginEdit") {
this.spacedUpdate.scheduleUpdate(); this.spacedUpdate.scheduleUpdate();
} }
}); });