Rich text / foldkit-mixins-richtext
Outline, footnotes, and command palette
tableOfContents<Message>(): RendersRichText.outlineOf(document)as anavlist, markingRichText.sectionAtwitharia-current="location"and callingchosen(node)on click (returns empty when no headings exist). Slots:root(nav),list(ul),entry(button with--fk-toc-level).footnotePreview<Message>(): Renders when the caret is inside aFootnoteRef(RichText.footnoteAt), showing the note text, a label field emittingRenamedFootnote, and a Go to note button sendingopened(definition). Slots:root(role="group"),label(TextInput),text(Container),button(Interactive).commandPalette<Message>(): SearchesslashEntriesfrom a standalonerole="combobox"dialog driven by{ query, index } | nullin your Model:
ts
import { commandPalette } from 'foldkit-mixins-richtext'
const commands = slashEntries(event => Message.ChoseCommand({ event }))
model.palette === null
? h.empty
: commandPalette<Message>()(
{
id: 'commands',
entries: commands,
query: model.palette.query,
index: model.palette.index,
changed: (query, index) => Message.ChangedPalette({ query, index }),
closed: Message.ClosedPalette(),
},
h,
)| Slot | Capability | Renders |
|---|---|---|
root | Container | role="dialog" palette |
input | TextInput | role="combobox" search input |
list | Collection | role="listbox" matches |
option | Interactive | Option row with data-entry and aria-selected |
Show word counts and validation diagnostics
editorStatus<Message>() displays cached word and character counts (RichText.count) alongside any diagnostics you pass from RichText.validate:
ts
import { editorStatus } from 'foldkit-mixins-richtext'
editorStatus<Message>()(
{ document: model.document, diagnostics: RichText.validate(model.document, ArticleKit) },
h,
)| Slot | Capability | Renders |
|---|---|---|
root | Container | Status bar wrapper |
counts | Base | Counts summary with data-status="counts" |
problems | Collection | Diagnostics list with data-status="problems" |
problem | Base | Diagnostic item with data-code and data-node |