mirror of
https://github.com/4source/favorites-obsidian-plugin.git
synced 2026-07-22 06:44:46 +00:00
* Add commands for managing favorite lists * Refactor favoritePlugins and favoriteThemes handling for improved clarity and performance * Add community plugin/theme management commands and fetch functions * Add note about using a separate key for favorite lists during development * Fix plugin id * Add backup and restore command for favorite lists * Add detailed command descriptions for managing favorite lists in README
23 lines
No EOL
558 B
TypeScript
23 lines
No EOL
558 B
TypeScript
import { App, FuzzySuggestModal } from 'obsidian';
|
|
|
|
export class StringSuggestModal extends FuzzySuggestModal<string> {
|
|
private items: string[] = [];
|
|
onSubmit: (result: string) => void = () => { };
|
|
|
|
constructor(app: App, title: string, items: string[], onSubmit: (result: string) => void) {
|
|
super(app);
|
|
this.setPlaceholder(title);
|
|
this.items = items;
|
|
this.onSubmit = onSubmit;
|
|
}
|
|
|
|
getItems(): string[] {
|
|
return this.items;
|
|
}
|
|
getItemText(item: string): string {
|
|
return item;
|
|
}
|
|
onChooseItem(item: string): void {
|
|
this.onSubmit(item);
|
|
}
|
|
} |