Rich text / foldkit-richtext-dom
The editor's Messages
foldkit-richtext-dom/editor holds the vocabulary an editor's update handles. Message's
cases (each built as Message.Typed({ text }) and so on, not exported one by one):
Typed, Backspace, DeletedForward, Entered, ToggledMark, AppliedMark, ClearedMark,
RetypedBlock, WrappedBlock, ConvertedBlock, LiftedBlock, MovedBlock, InsertedBlock,
DeletedBlock, ChangedProps, InsertedRow, InsertedColumn, DeletedRow, DeletedColumn, Indented,
Outdented, ActivatedAdornment, Selected, Pasted, Undone, Redone, PatchedThe adapter reports what the browser did as commands, a caret, and history chords, and
toMessage turns each into a Message. It refuses what the vocabulary cannot carry rather than
dropping a detail: an insertion carrying marks, or a mark value with props, comes back
undefined. The rest are the application's to send, because no browser event means them:
RetypedBlock,WrappedBlock({ containers }),ConvertedBlock({ to }), andLiftedBlockfor the core's block commands;MovedBlock({ node, to },toaRichText.Beside), which a block handle sends and which needs no selection;InsertedBlock({ block, to? }) andDeletedBlock({ node }) forInsertBlockandDeleteBlock: an insert menu's image or table, a handle's Duplicate and Delete;ChangedProps({ node, props }) forSetProps. The adapter sends it too, for a click on a block's adornment that toggles a prop (a task's checkbox, fromElementRendering.adornments);InsertedRowandInsertedColumn({ where }),DeletedRowandDeletedColumnfor the table commands, which act on the caret's cell: what a table toolbar sends;IndentedandOutdentedforIndentandOutdent. The adapter sends them for Tab and Shift+Tab, but only whereRichText.takesTabsays Tab means something (code, a table cell, under the placement's vocabulary); anywhere else Tab is left to move focus;ReplacedText({ query, replacement, caseSensitive?, at? }) forReplace: one match, or every match, as one undo step, which a find bar sends;InsertedFootnote({ text? }) andRenamedFootnote({ from, to }) forInsertFootnoteandRenameFootnote, which needFootnoteRefin the placement's vocabulary;ActivatedAdornment({ node, action }): an adornment with anactionwas clicked, a code block's Copy, say. It is no edit, and the editor changes nothing; the application acts on it;AppliedMark({ mark }, a name or a{ name, props }value) andClearedMark({ mark }) forSetMarkandClearMark: what a link editor sends, which at a caret changes or removes the whole link the caret is in.
Patched is the patch Command's own completion, because a Foldkit Command must return a
Message.