mirror of
https://github.com/mryanb/obsidian-asana.git
synced 2026-07-22 05:38:24 +00:00
Added content to styles.css so Github build doesn't error out
Remove duplicate file
This commit is contained in:
parent
c2c660df54
commit
fa4a6f379c
2 changed files with 1 additions and 49 deletions
|
|
@ -0,0 +1 @@
|
|||
/* I didn't actualy need any styles yet */
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
import { App, FuzzySuggestModal } from 'obsidian';
|
||||
|
||||
/**
|
||||
* A modal for selecting items with fuzzy search support.
|
||||
*/
|
||||
export class FuzzySelectModal extends FuzzySuggestModal<{ name: string; gid: string; isPinned?: boolean }> {
|
||||
private resolve: (value: { name: string; gid: string } | null) => void;
|
||||
private items: Array<{ name: string; gid: string; isPinned?: boolean }>;
|
||||
private title: string;
|
||||
private selectedItem: { name: string; gid: string } | null = null;
|
||||
private resolved: boolean = false; // Prevents resolving multiple times
|
||||
|
||||
constructor(
|
||||
app: App,
|
||||
title: string,
|
||||
items: Array<{ name: string; gid: string; isPinned?: boolean }>,
|
||||
resolve: (value: { name: string; gid: string } | null) => void
|
||||
) {
|
||||
super(app);
|
||||
this.title = title;
|
||||
this.items = items;
|
||||
this.resolve = resolve;
|
||||
}
|
||||
|
||||
onOpen() {
|
||||
super.onOpen();
|
||||
this.setTitle(this.title);
|
||||
this.setPlaceholder(this.title);
|
||||
}
|
||||
|
||||
getItems(): Array<{ name: string; gid: string; isPinned?: boolean }> {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
getItemText(item: { name: string; gid: string; isPinned?: boolean }): string {
|
||||
return item.isPinned ? `📌 ${item.name.replace(/^📌 /, '')}` : item.name;
|
||||
}
|
||||
|
||||
onChooseItem(item: { name: string; gid: string }, evt: MouseEvent | KeyboardEvent) {
|
||||
if (!this.resolved) {
|
||||
console.log(`ITEM CHOSEN - ${item.name} (gid: ${item.gid})`);
|
||||
this.selectedItem = item;
|
||||
this.resolved = true; // Prevents multiple selections
|
||||
this.resolve(item);
|
||||
} else {
|
||||
console.warn(`ITEM CHOSEN MULTIPLE TIMES - Ignoring extra selection: ${item.name}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue