andy-stack_vaultkeeper-ai/Views/MainView.ts
2025-09-08 15:50:06 +01:00

40 lines
No EOL
712 B
TypeScript

import { ItemView, WorkspaceLeaf } from 'obsidian';
import Input from '../Components/Input.svelte';
import { mount, unmount } from 'svelte';
export const VIEW_TYPE_MAIN = 'main-view';
export class MainView extends ItemView {
constructor(leaf: WorkspaceLeaf) {
super(leaf);
}
input: ReturnType<typeof Input> | undefined;
getViewType() {
return VIEW_TYPE_MAIN;
}
getDisplayText() {
return 'Main View';
}
async onOpen() {
const container = this.contentEl;
container.empty();
this.input = mount(Input, {
target: container,
props: {
input: "",
}
});
}
async onClose() {
if (this.input) {
unmount(this.input);
}
}
}