Rich text / foldkit-mixins-richtext

SlashEntry

interface · packages/richtext-dom/src/editor.ts:147

interface SlashEntry<Payload> {
  readonly id: string
  readonly label: string
  readonly keywords: ReadonlyArray<string>
  readonly message: Payload
  readonly description?: string | undefined
  readonly group?: string | undefined
  readonly icon?: string | undefined
}

The slash menu's vocabulary (§123, §124 §11): what opens a menu, what it offers, what a query matches, and what a chosen entry sends. An entry carries one of this module's Messages, not a command, so the Bundle resolves Enter by handling the chosen entry as the Message a click would send — which is also what makes a mark entry update the caret's stored marks rather than run a collapsed toggle the command layer treats as a no-op.

Whether a caret is in a query is a read of the document (RichText.textBefore), not a flag. Nothing here holds state.

Members

SlashEntry.id

property · packages/richtext-dom/src/editor.ts:149

readonly id: string

Stable id, not the label: how a list keys the entry and moves by it.

SlashEntry.label

property · packages/richtext-dom/src/editor.ts:151

readonly label: string

What the menu shows.

SlashEntry.keywords

property · packages/richtext-dom/src/editor.ts:153

readonly keywords: ReadonlyArray<string>

Words a query may match besides the label.

SlashEntry.message

property · packages/richtext-dom/src/editor.ts:155

readonly message: Payload

What choosing this entry sends: an editor Message here, a caller's in a view.

SlashEntry.description

property · packages/richtext-dom/src/editor.ts:157

readonly description?: string | undefined

A line under the label saying what the entry makes.

SlashEntry.group

property · packages/richtext-dom/src/editor.ts:159

readonly group?: string | undefined

The heading the entry is listed under while no query narrows the menu.

SlashEntry.icon

property · packages/richtext-dom/src/editor.ts:161

readonly icon?: string | undefined

The icon a menu draws for it, by name; a view's own set says what names it knows.