From 9f26d6efdcde4cbf163be2a61b17d10f4500d9b7 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 10 Apr 2026 21:11:49 +0300 Subject: [PATCH] feat(text): render note icons in autocompletion (closes #8188) --- apps/client/src/services/note_autocomplete.ts | 3 ++- apps/client/src/widgets/type_widgets/text/config.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/client/src/services/note_autocomplete.ts b/apps/client/src/services/note_autocomplete.ts index 9ca4fa86fb..18982307ac 100644 --- a/apps/client/src/services/note_autocomplete.ts +++ b/apps/client/src/services/note_autocomplete.ts @@ -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 }; }) ); diff --git a/apps/client/src/widgets/type_widgets/text/config.ts b/apps/client/src/widgets/type_widgets/text/config.ts index 29b1a02699..f36eaadbd2 100644 --- a/apps/client/src/widgets/type_widgets/text/config.ts +++ b/apps/client/src/widgets/type_widgets/text/config.ts @@ -182,9 +182,16 @@ export async function buildConfig(opts: BuildEditorOptions): Promise 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 = ` ${suggestion.highlightedNotePathTitle} `; return itemElement; },