Skip to content

Commit

Permalink
0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
zsviczian committed May 8, 2022
1 parent 32d2fb2 commit 5b82c20
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
24 changes: 17 additions & 7 deletions src/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -448,16 +458,16 @@ export class Scene {
this.blockUpdateTimer = false;
}

private addEventHandler() {
private async addEventHandler() {
const self = this;

const brainEventHandler = async (leaf:WorkspaceLeaf) => {
if(this.disregardLeafChange) {
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) {
Expand Down Expand Up @@ -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
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"0.0.5": "0.14.0"
"0.0.6": "0.14.0"
}

0 comments on commit 5b82c20

Please sign in to comment.