feat: add secondary search parameter

This commit is contained in:
huaqo
2026-04-24 19:31:38 +02:00
parent d8dc81dcff
commit eba9a2c113
12 changed files with 253 additions and 162 deletions
+7 -4
View File
@@ -3,19 +3,22 @@ import { App, FuzzyMatch, FuzzySuggestModal } from 'obsidian';
import { ZoteroClient } from "./ZoteroClient";
import { ZoteroItem } from "./ZoteroItem";
import { loadItems, renderZoteroItem } from "./Utils"
import { Settings } from "./Settings";
const ZOTERO_BASE_URL = "zotero://select/library/items/";
export class OpenModal extends FuzzySuggestModal<ZoteroItem> {
private client: ZoteroClient;
private items: ZoteroItem[] = [];
private settings: Settings
constructor(
app: App,
port: string,
settings: Settings,
) {
super(app);
this.client = new ZoteroClient(port);
this.settings = settings;
this.client = new ZoteroClient(this.settings.port);
this.setPlaceholder("Loading...");
}
@@ -29,11 +32,11 @@ export class OpenModal extends FuzzySuggestModal<ZoteroItem> {
}
getItemText(item: ZoteroItem): string {
return item.toString();
return `${item.title} ${item[this.settings.search]}`;
}
renderSuggestion(match: FuzzyMatch<ZoteroItem>, el: HTMLElement) {
renderZoteroItem(match, el);
renderZoteroItem(match, el, this.settings.search);
}
onChooseItem(item: ZoteroItem) {