diff --git a/manifest.json b/manifest.json index f3e7bf0..b44da70 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "id": "excalibrain", "name": "ExcaliBrain", - "version": "0.1.3", - "minAppVersion": "0.15.3", + "version": "0.1.4", + "minAppVersion": "0.15.5", "description": "A clean, intuitive and editable graph view for Obsidian", "author": "Zsolt Viczian", "authorUrl": "https://zsolt.blog", diff --git a/src/Scene.ts b/src/Scene.ts index 37d7d58..0e7fbc5 100644 --- a/src/Scene.ts +++ b/src/Scene.ts @@ -89,7 +89,7 @@ export class Scene { * @param path * @returns */ - public async renderGraphForPath(path: string) { + public async renderGraphForPath(path: string, openFile:boolean = true) { if(!this.isActive()) { return; } @@ -132,7 +132,7 @@ export class Scene { return; //don't reload the file if it has not changed } - if(isFile) { + if(isFile && openFile) { //@ts-ignore if(!this.centralLeaf || !app.workspace.getLeafById(this.centralLeaf.id)) { this.centralLeaf = this.ea.openFileInNewOrAdjacentLeaf(page.file); diff --git a/src/main.ts b/src/main.ts index a33e239..6a0377e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -500,7 +500,9 @@ export default class ExcaliBrain extends Plugin { return false; } } - this.scene?.renderGraphForPath(path); + //had to add this, because the leaf that opens the file does not get focus, thus the on leaf change + //event handler does not run + this.scene?.renderGraphForPath(path,false); return true; } this.scene?.renderGraphForPath(path); @@ -713,6 +715,14 @@ export default class ExcaliBrain extends Plugin { if(!leaf.view) { return; } + if(!(leaf.view instanceof TextFileView)) { + new Notice("Wrong view type. Cannot start ExcaliBrain."); + return; + } + if(leaf.view.file.path !== this.settings.excalibrainFilepath) { + new Notice(`The brain file is not the one configured in settings!\nThe file in settings is ${this.settings.excalibrainFilepath}.\nThis file is ${leaf.view.file.path}.\nPlease start ExcaliBrain using the Command Palette action.`,5000); + return; + } let counter = 0; while(!this.pluginLoaded && counter++<100) await sleep(50); if(!this.pluginLoaded) { diff --git a/versions.json b/versions.json index 8a84490..7f3db7d 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "0.1.4": "0.15.5", "0.1.3": "0.15.3", "0.1.0": "0.15.2", "0.0.22": "0.14.0"