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.

SlotCapabilityRenders
rootContainerMenu wrapper
listCollectionMatch list
headingContainerGroup heading before its first item
itemInteractiveMenu row with data-entry and aria-current="true"
iconContainerEntry icon
labelContainerEntry label
descriptionContainerEntry description
emptyContainer"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.