import { mount, unmount } from "svelte"; import { App, Modal } from "@/deps.ts"; import ObsidianLiveSyncPlugin from "@/main.ts"; import PluginPane from "./PluginPane.svelte"; export class PluginDialogModal extends Modal { plugin: ObsidianLiveSyncPlugin; component: ReturnType | undefined; isOpened() { return this.component != undefined; } constructor(app: App, plugin: ObsidianLiveSyncPlugin) { super(app); this.plugin = plugin; } override onOpen() { const { contentEl } = this; this.contentEl.setCssStyles({ overflow: "auto", display: "flex", flexDirection: "column", }); this.titleEl.setText("Customization Sync (Beta3)"); if (!this.component) { this.component = mount(PluginPane, { target: contentEl, props: { plugin: this.plugin, core: this.plugin.core }, }); } } override onClose() { if (this.component) { void unmount(this.component); this.component = undefined; } } }