mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 16:30:27 +00:00
Add Exception helper class for consistent error handling and logging. Replace throw statements and console.error calls with Exception methods. Update service methods to return Error | T instead of mixed success/failure objects. Improve type safety in Claude.extractContents with explicit return type. Add WikiLinks helper to VaultCacheService for managing wiki link references. Update unit tests.
48 lines
No EOL
1.3 KiB
TypeScript
48 lines
No EOL
1.3 KiB
TypeScript
import type VaultkeeperAIPlugin from "main";
|
|
import { Modal } from "obsidian";
|
|
import { Resolve } from "Services/DependencyService";
|
|
import { Services } from "Services/Services";
|
|
import HelpModalSvelte from './HelpModalSvelte.svelte';
|
|
import { mount, unmount } from 'svelte';
|
|
import { Selector } from 'Enums/Selector';
|
|
|
|
export class HelpModal extends Modal {
|
|
|
|
private component: ReturnType<typeof mount> | null = null;
|
|
private initialTopic?: number;
|
|
|
|
public constructor() {
|
|
const plugin = Resolve<VaultkeeperAIPlugin>(Services.VaultkeeperAIPlugin);
|
|
super(plugin.app);
|
|
}
|
|
|
|
onOpen() {
|
|
const { contentEl, modalEl, containerEl } = this;
|
|
|
|
containerEl.addClass(Selector.HelpModal);
|
|
modalEl.addClass(Selector.HelpModal);
|
|
|
|
this.component = mount(HelpModalSvelte, {
|
|
target: contentEl,
|
|
props: {
|
|
onClose: () => this.close(),
|
|
initialTopic: this.initialTopic
|
|
}
|
|
});
|
|
}
|
|
|
|
public open(initialTopic?: number) {
|
|
this.initialTopic = initialTopic;
|
|
super.open();
|
|
}
|
|
|
|
onClose() {
|
|
if (this.component) {
|
|
void unmount(this.component);
|
|
this.component = null;
|
|
}
|
|
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
}
|
|
} |