mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Add detailed plugin guide covering modes, references, and instructions - Add troubleshooting section with API key and rate limit solutions - Add privacy documentation explaining data storage and exclusions - Make "User Instructions" text clickable to open help modal - Support opening help modal to specific topic via initialTopic prop - Add internal link handling to navigate from help modal to vault files - Update About section with GitHub link and contribution info
47 lines
No EOL
1.2 KiB
TypeScript
47 lines
No EOL
1.2 KiB
TypeScript
import type AIAgentPlugin 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: Record<string, any> | null = null;
|
|
|
|
public constructor() {
|
|
const plugin = Resolve<AIAgentPlugin>(Services.AIAgentPlugin);
|
|
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 as any).initialTopic
|
|
}
|
|
});
|
|
}
|
|
|
|
public open(initialTopic?: number): void {
|
|
(this as any).initialTopic = initialTopic;
|
|
super.open();
|
|
}
|
|
|
|
onClose() {
|
|
if (this.component) {
|
|
unmount(this.component);
|
|
this.component = null;
|
|
}
|
|
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
}
|
|
} |