From f4d732fa0e69ad926f03e9b98e9101dc686e02ee Mon Sep 17 00:00:00 2001 From: Xu Quan Date: Tue, 25 Feb 2025 11:37:38 +0800 Subject: [PATCH] fix: avoid detach leaves in onunload --- src/main.ts | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/main.ts b/src/main.ts index ca79eb1..2fb5e8d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -90,7 +90,6 @@ export default class FolderFileSplitterPlugin extends Plugin { }; onunload() { - this.detachFileTreeLeafs(); this.app.vault.off("create", this.onCreate); this.app.vault.off("modify", this.onModify); this.app.vault.off("delete", this.onDelete); @@ -119,17 +118,4 @@ export default class FolderFileSplitterPlugin extends Plugin { async saveSettings() { await this.saveData(this.settings); } - - detachFileTreeLeafs = () => { - const leafs = this.app.workspace.getLeavesOfType(this.VIEW_TYPE); - for (const leaf of leafs) { - (leaf.view as FileTreeView).destroy(); - leaf.detach(); - } - }; - - refreshTreeLeafs = (showAfterAttach: boolean) => { - this.detachFileTreeLeafs(); - this.openFileTreeLeaf(showAfterAttach); - }; }