Rich text / API

foldkit-richtext-dom/editor

The editor's Message vocabulary and the mount that produces it (§§31, 118).

The DOM adapter reports what the browser asked for as commands, a caret, and a history chord. This is what those mean to an editor's update, so one set of Messages arrives whether a person typed, pasted, or moved the caret. The Bundle proof in controlled.ts consumed these by hand; events is where the browser produces them.

Functions

attachEditorAttaches the translation to a host element and reports each Message through emit. Separate from the mount so a test can drive the DOM without pulling a…
focusEditorFocuses the editor at hostId with selection in the browser (Attachment.focus); false when none is attached there.
heldDocumentThe latest document the editor at hostId holds (Attachment.held), or undefined when none is attached there.
matchingEntriesThe entries a query matches, case-insensitively, the best first: a label it starts, a word of a label it starts, a keyword it starts, then any it appears…
patchEditorThe patch Command's work: find the element the view gave an id to and sync the attachment it holds. A missing host is not an error — the editor went away…
redecorateEditorDraws the decorations of the editor at hostId again; false when none is attached there.
slashMenuThe menu the caret is in, or undefined when its text is not a slash command — the one value that decides both whether to render a menu and what Enter means,…
slashQueryThe query the caret is in, or undefined when the text before it is not a slash command. A command opens at a block's start or after whitespace — see /head…
toMessageWhat a browser intent means to an editor. The adapter reports only plain insertions, so an insertion carrying marks is refused rather than quietly losing…

Values

eventsThe editor's events as a mount: one attachment per element, released with it. The rendering registry is looked up by the host id the placement recorded…
Message
slashEntriesThe entries the editor offers, in menu order: the text blocks a caret can become, the standard vocabulary's quote, lists, and code block, then the marks it…

Interfaces

EditorDrawingHow an attached editor draws: its rendering registry and what it draws over the document.
SlashEntryThe 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…
SlashMenuWhat a menu shows for one caret: its query, what matches, and what Enter would send.

Types

EditorEventWhat the DOM can ask for: the vocabulary without the patch acknowledgement, which only the Command produces. The adapter's stream is typed by this, so a…