fix(plugin): use getLeavesOfType + revealLeaf to focus existing file-explorer

This commit is contained in:
Research Assistant 2026-05-14 01:39:26 +08:00
parent 862b0d1988
commit 51edce7630

View file

@ -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);
}