3 - Added Prettier for formatting and formatted.

This commit is contained in:
Caleb Campbell
2025-12-26 09:43:29 +11:00
parent 0275b5a439
commit 054744e35b
26 changed files with 955 additions and 1123 deletions

View File

@@ -1,28 +1,28 @@
import { AbstractInputSuggest, App, TFolder } from "obsidian";
import { AbstractInputSuggest, App, TFolder } from 'obsidian';
export default class PathSuggest extends AbstractInputSuggest<string> {
private textInputEl: HTMLInputElement | HTMLDivElement;
private textInputEl: HTMLInputElement | HTMLDivElement;
constructor(app: App, textInputEl: HTMLInputElement | HTMLDivElement) {
super(app, textInputEl);
this.textInputEl = textInputEl;
}
constructor(app: App, textInputEl: HTMLInputElement | HTMLDivElement) {
super(app, textInputEl);
this.textInputEl = textInputEl;
}
async getSuggestions(query: string): Promise<string[]> {
query ||= '/';
const folder = this.app.vault.getFolderByPath(query);
if (!folder) return [];
return folder.children
.filter(c => c instanceof TFolder)
.map(f => f.path);
}
async getSuggestions(query: string): Promise<string[]> {
query ||= '/';
const folder = this.app.vault.getFolderByPath(query);
if (!folder) return [];
return folder.children
.filter((c) => c instanceof TFolder)
.map((f) => f.path);
}
renderSuggestion(item: string, el: HTMLElement): void {
el.setText(item);
}
renderSuggestion(item: string, el: HTMLElement): void {
el.setText(item);
}
selectSuggestion(item: string, _: MouseEvent | KeyboardEvent): void {
this.setValue(item);
this.textInputEl.dispatchEvent(new Event('input'));
}
}
selectSuggestion(item: string, _: MouseEvent | KeyboardEvent): void {
this.setValue(item);
this.textInputEl.dispatchEvent(new Event('input'));
}
}