Rich text / foldkit-mixins-richtext
Render the slash menu
slashMenuView renders the filtered slash menu entries while slashMove updates menuIndex on arrow, Home, and End keys:
ts
import { slashEntries, slashMenuView, slashMove } from 'foldkit-mixins-richtext'
import { menuTextOf } from 'foldkit-richtext-dom/editor-bundle'
const entries = slashEntries(message => edited(message))
const next = slashMove(entries, 'see /head', model.editor.menuIndex, 'ArrowDown', modifiers)
slashMenuView<Message>()(
{ entries, textBefore: menuTextOf({ document, ...model.editor }), index: model.editor.menuIndex },
h,
)Handle ArrowUp/ArrowDown and Home/End with OnKeyDownPreventDefault while a query is open, and send DismissedSlash on Escape. Reading menuTextOf ensures slashMenuView stays hidden after Escape until a new / query begins.
| Slot | Capability | Renders |
|---|---|---|
root | Container | Menu wrapper |
list | Collection | Match list |
heading | Container | Group heading before its first item |
item | Interactive | Menu row with data-entry and aria-current="true" |
icon | Container | Entry icon |
label | Container | Entry label |
description | Container | Entry description |
empty | Container | "No matches" fallback |
Render editor icons
richTextIcon(h, name, { size }) draws inline Lucide SVG icons hidden from assistive technology (aria-hidden), and richTextIconUrl(name) produces a CSS url(...) data URI for masked CSS adornments. isRichTextIcon(name) checks whether an icon name exists across slash entries, marks, blocks, and toolbar actions.