Files
obsidian-livesync/src/features/ConfigSync/PluginDialogModal.ts
T
2026-06-17 05:51:01 +01:00

40 lines
1.1 KiB
TypeScript

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<typeof mount> | 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;
}
}
}