diff --git a/manifest.json b/manifest.json index 0b37ec2..e3943c0 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "excalibrain", "name": "ExcaliBrain", - "version": "0.0.5", + "version": "0.0.6", "minAppVersion": "0.14.0", "description": "A clean, intuitive and editable graph view for Obsidian", "author": "Zsolt Viczian", diff --git a/src/Scene.ts b/src/Scene.ts index 93467ca..55acc4d 100644 --- a/src/Scene.ts +++ b/src/Scene.ts @@ -134,8 +134,18 @@ export class Scene { this.addToHistory(page.path); } + if(page.isFolder && !this.plugin.settings.showFolderNodes) { + this.plugin.settings.showFolderNodes = true; + this.toolsPanel.rerender(); + } + + if(page.isTag && !this.plugin.settings.showTagNodes) { + this.plugin.settings.showTagNodes = true; + this.toolsPanel.rerender(); + } + this.centralPagePath = path; - await this.plugin.createIndex(); + //await this.plugin.createIndex(); await this.render(); } @@ -448,7 +458,7 @@ export class Scene { this.blockUpdateTimer = false; } - private addEventHandler() { + private async addEventHandler() { const self = this; const brainEventHandler = async (leaf:WorkspaceLeaf) => { @@ -456,8 +466,8 @@ export class Scene { return; } self.blockUpdateTimer = true; - await self.plugin.createIndex(); - //await new Promise((resolve) => setTimeout(resolve, 100)); + //await self.plugin.createIndex(); + await new Promise((resolve) => setTimeout(resolve, 100)); //------------------------------------------------------- //terminate event handler if view no longer exists or file has changed if(!self.ea.targetView?.file || self.ea.targetView.file.path !== self.plugin.settings.excalibrainFilepath) { @@ -520,11 +530,11 @@ export class Scene { leaves.push(l); } }) - + + await this.plugin.createIndex(); //temporary + if(leaves.length>0) { brainEventHandler(leaves[0]); - } else { - this.plugin.createIndex(); //temporary } } diff --git a/src/main.ts b/src/main.ts index 6a13882..5162bf8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -237,10 +237,16 @@ export default class ExcaliBrain extends Plugin { } this.EA.onLinkClickHook = (element,linkText) => { + const path = linkText.match(/\[\[([^\]]*)/)[1]; if(!linkText.startsWith("[[folder:") && !linkText.startsWith("[[tag:")) { + //@ts-ignore + if(this.scene?.centralLeaf?.view?.file?.path === path) { + this.scene?.renderGraphForPath(path); + return false; + } return true; } - this.scene?.renderGraphForPath(linkText.match(/\[\[([^\]]*)/)[1]); + this.scene?.renderGraphForPath(path); return false; } diff --git a/versions.json b/versions.json index 5781ed7..fd7a836 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "0.0.5": "0.14.0" + "0.0.6": "0.14.0" }