mirror of
https://github.com/dragonish/obsidian-heading-decorator.git
synced 2026-07-22 05:42:05 +00:00
21 lines
568 B
TypeScript
21 lines
568 B
TypeScript
import { App, AbstractInputSuggest } from "obsidian";
|
|
|
|
export class FolderSuggest extends AbstractInputSuggest<string> {
|
|
constructor(
|
|
public app: App,
|
|
public textInputEl: HTMLInputElement | HTMLDivElement
|
|
) {
|
|
super(app, textInputEl);
|
|
}
|
|
|
|
getSuggestions(query: string): string[] {
|
|
const folders = this.app.vault.getAllFolders();
|
|
return folders
|
|
.map((folder) => folder.path)
|
|
.filter((path) => path.toLowerCase().includes(query.toLowerCase()));
|
|
}
|
|
|
|
renderSuggestion(value: string, el: HTMLElement) {
|
|
el.setText(value);
|
|
}
|
|
}
|