feat(text): render note icons in autocompletion (closes #8188)

This commit is contained in:
Elian Doran
2026-04-10 21:11:49 +03:00
parent 043e620231
commit 9f26d6efdc
2 changed files with 10 additions and 2 deletions

View File

@@ -68,7 +68,8 @@ async function autocompleteSourceForCKEditor(queryText: string) {
name: row.notePathTitle || "",
link: `#${row.notePath}`,
notePath: row.notePath,
highlightedNotePathTitle: row.highlightedNotePathTitle
highlightedNotePathTitle: row.highlightedNotePathTitle,
icon: row.icon
};
})
);

View File

@@ -182,9 +182,16 @@ export async function buildConfig(opts: BuildEditorOptions): Promise<EditorConfi
marker: "@",
feed: (queryText: string) => noteAutocompleteService.autocompleteSourceForCKEditor(queryText),
itemRenderer: (item) => {
const suggestion = item as Suggestion;
const itemElement = document.createElement("button");
itemElement.innerHTML = `${(item as Suggestion).highlightedNotePathTitle} `;
// Choose appropriate icon based on action
let iconClass = suggestion.icon ?? "bx bx-note";
if (suggestion.action === "create-note") {
iconClass = "bx bx-plus";
}
itemElement.innerHTML = `<span class="${iconClass}"></span> ${suggestion.highlightedNotePathTitle} `;
return itemElement;
},