From 51edce76307b010f3788fbf0123974a72d612422 Mon Sep 17 00:00:00 2001 From: Research Assistant Date: Thu, 14 May 2026 01:39:26 +0800 Subject: [PATCH] fix(plugin): use getLeavesOfType + revealLeaf to focus existing file-explorer --- paperforge/plugin/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paperforge/plugin/main.js b/paperforge/plugin/main.js index 5a26ea99..dada9385 100644 --- a/paperforge/plugin/main.js +++ b/paperforge/plugin/main.js @@ -1535,7 +1535,10 @@ class PaperForgeStatusView extends ItemView { const baseDir = plugin?.settings?.base_dir || 'Bases'; const baseFile = this.app.vault.getAbstractFileByPath(baseDir); if (baseFile) { - this.app.internalPlugins.getPluginById('file-explorer')?.enable?.(true); + const leaves = this.app.workspace.getLeavesOfType('file-explorer'); + if (leaves.length > 0) { + this.app.workspace.revealLeaf(leaves[0]); + } } else { new Notice('[!!] Base directory not found: ' + baseDir, 6000); }