fix: avoid detach leaves in onunload

This commit is contained in:
Xu Quan 2025-02-25 11:37:38 +08:00
parent 482e94f953
commit f4d732fa0e

View file

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