From efe451b585c23d7aa33e4dca6231832329c4b644 Mon Sep 17 00:00:00 2001 From: YamiZee Date: Thu, 8 May 2025 20:58:12 +0300 Subject: [PATCH 1/2] "open juggl" context menu option on folder opens global graph filtered on that path --- src/main.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index f8a6437..2de7f93 100644 --- a/src/main.ts +++ b/src/main.ts @@ -121,6 +121,8 @@ export default class JugglPlugin extends Plugin implements IJugglPlugin { .onClick((evt) => { if (file.extension === 'md') { this.openLocalGraph(file.basename); + } else if (file.extension === undefined) { + this.openGlobalGraph(file.path); } else { this.openLocalGraph(file.name); } @@ -277,19 +279,23 @@ export default class JugglPlugin extends Plugin implements IJugglPlugin { await leaf.open(neovisView); } - async openGlobalGraph() { + async openGlobalGraph(path: string | undefined = undefined) { const leaf = this.app.workspace.getLeaf(false); + const settings = Object.assign({}, this.settings.globalGraphSettings); + if (path) { + settings.filter = "path:" + path; + } // const query = this.localNeighborhoodCypher(name); const names = this.app.vault.getFiles().map((f) => f.extension === 'md'? f.basename : f.name); if (names.length > 250) { const modal = new GlobalWarningModal(this.app, async () => { - const neovisView = new JugglView(leaf, this.settings.globalGraphSettings, this, names); + const neovisView = new JugglView(leaf, settings, this, names); await leaf.open(neovisView); modal.close(); }); modal.open(); } else { - const neovisView = new JugglView(leaf, this.settings.globalGraphSettings, this, names); + const neovisView = new JugglView(leaf, settings, this, names); await leaf.open(neovisView); } } From ccf9f7f0f866cfdc043e838c03ee031d099995bd Mon Sep 17 00:00:00 2001 From: YamiZee Date: Thu, 8 May 2025 22:16:28 +0300 Subject: [PATCH 2/2] add options parameter to openGlobalGraph --- src/main.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index 2de7f93..046dc4b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -122,7 +122,7 @@ export default class JugglPlugin extends Plugin implements IJugglPlugin { if (file.extension === 'md') { this.openLocalGraph(file.basename); } else if (file.extension === undefined) { - this.openGlobalGraph(file.path); + this.openGlobalGraph({ filter: "path:" + file.path }); } else { this.openLocalGraph(file.name); } @@ -279,12 +279,9 @@ export default class JugglPlugin extends Plugin implements IJugglPlugin { await leaf.open(neovisView); } - async openGlobalGraph(path: string | undefined = undefined) { + async openGlobalGraph(options: Partial = {}) { const leaf = this.app.workspace.getLeaf(false); - const settings = Object.assign({}, this.settings.globalGraphSettings); - if (path) { - settings.filter = "path:" + path; - } + const settings = Object.assign({}, this.settings.globalGraphSettings, options); // const query = this.localNeighborhoodCypher(name); const names = this.app.vault.getFiles().map((f) => f.extension === 'md'? f.basename : f.name); if (names.length > 250) {