This commit is contained in:
Oscar Plaisant
2024-09-20 21:31:23 +02:00
parent 2a56343d56
commit 62f0313af1
412 changed files with 64451 additions and 81085 deletions

View File

@@ -566,16 +566,31 @@ var LovelyMindmap = class extends import_obsidian2.Plugin {
if (!!this.canvas) {
clearInterval(this.intervalTimer.get("canvas"));
}
}, 1e3);
}, 100);
if (!this.intervalTimer.get("canvas")) {
this.intervalTimer.set("canvas", timer);
}
}
async onload() {
await this.setting.loadSettings();
this.addSettingTab(new Setting(this));
this.keymap.registerAll();
onActiveLeafChange() {
this.app.workspace.on("active-leaf-change", async (leaf) => {
var _a, _b;
const extension = (_b = (_a = leaf == null ? void 0 : leaf.view) == null ? void 0 : _a.file) == null ? void 0 : _b.extension;
if (extension === "canvas") {
this.onKeymap();
return;
}
this.onunload();
});
}
/**
* A series of events for canvas initialization
*
* - When switching away from the canvas viewport, remove the keyboard shortcuts and canvas instance.
* - When switching back to the canvas viewport, re-register the keyboard shortcuts and canvas instance.
*/
onKeymap() {
this.createCanvasInstance();
this.keymap.registerAll();
this.addCommand({
id: "blurNode",
name: "Blur node",
@@ -588,6 +603,12 @@ var LovelyMindmap = class extends import_obsidian2.Plugin {
checkCallback: () => this.keymap.blurNode()
});
}
async onload() {
await this.setting.loadSettings();
this.addSettingTab(new Setting(this));
this.onActiveLeafChange();
this.onKeymap();
}
onunload() {
this.keymap.unregisterAll();
this.intervalTimer.forEach(clearInterval);

View File

@@ -1,7 +1,7 @@
{
"id": "lovely-mindmap",
"name": "Lovely-Mindmap",
"version": "1.0.1",
"version": "1.0.3",
"minAppVersion": "0.15.0",
"description": "Build your own knowledge graph with smiles :-)",
"author": "shaun",