mirror of
https://github.com/decaf-dev/obsidian-vault-explorer.git
synced 2026-07-22 10:10:31 +00:00
chore: use new mount syntax for Svelte 5
This commit is contained in:
parent
369dfad524
commit
09f6f1666a
1 changed files with 9 additions and 6 deletions
|
|
@ -1,18 +1,19 @@
|
|||
import { ItemView, WorkspaceLeaf } from "obsidian";
|
||||
|
||||
import { VAULT_EXPLORER_VIEW } from "src/constants";
|
||||
import VaultExplorerApp from "../svelte/app/index.svelte";
|
||||
import VaultExplorerPlugin from "src/main";
|
||||
import EventManager from "src/event/event-manager";
|
||||
import { PluginEvent } from "src/event/types";
|
||||
import VaultExplorerPlugin from "src/main";
|
||||
import { mount, unmount } from "svelte";
|
||||
import VaultExplorerApp from "../svelte/app/index.svelte";
|
||||
|
||||
export default class VaultExplorerView extends ItemView {
|
||||
component: VaultExplorerApp | null;
|
||||
svelteApp: ReturnType<typeof mount> | null;
|
||||
plugin: VaultExplorerPlugin;
|
||||
|
||||
constructor(leaf: WorkspaceLeaf, plugin: VaultExplorerPlugin) {
|
||||
super(leaf);
|
||||
this.component = null;
|
||||
this.svelteApp = null;
|
||||
this.plugin = plugin;
|
||||
this.navigation = true;
|
||||
}
|
||||
|
|
@ -43,12 +44,14 @@ export default class VaultExplorerView extends ItemView {
|
|||
|
||||
const containerEl = this.containerEl.children[1];
|
||||
|
||||
this.component = new VaultExplorerApp({
|
||||
this.svelteApp = mount(VaultExplorerApp, {
|
||||
target: containerEl
|
||||
});
|
||||
}
|
||||
|
||||
async onClose() {
|
||||
this.component?.$destroy();
|
||||
if (this.svelteApp) {
|
||||
unmount(this.svelteApp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue