mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
fix(plugin): use getLeavesOfType + revealLeaf to focus existing file-explorer
This commit is contained in:
parent
862b0d1988
commit
51edce7630
1 changed files with 4 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue