mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
client: Improve mind map saving & centering
This commit is contained in:
parent
1b08487ee9
commit
6c54f3c804
@ -40,17 +40,19 @@ export default class MindMapWidget extends TypeWidget {
|
|||||||
this.#initLibrary();
|
this.#initLibrary();
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.#loadData(note);
|
await this.#loadData(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
this.triggeredByUserOperation = false;
|
this.triggeredByUserOperation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user