Rich text / foldkit-mixins-richtext

The contract every view keeps

  • It holds no state. Whether a palette is open, what is typed in a field, which entry is highlighted: each is the application's, passed in and changed through a Message.
  • What it shows is a read of the document. A pressed mark (markActive), the caret's block style (RichText.textBlockAt), the link around the caret (RichText.linkAt), and the slash menu (RichText.textBefore) are computed from the document and selection it is given.
  • Messages go out through what the caller passes. An editor Message goes through wrap (or toggled), because the caller usually dispatches a wrapper such as the editor Bundle's edited; an application Message through a named callback, such as changed or closed.
  • Every element is a slot. Each view names its slots and their capabilities in a table below; Style and Behaviors reach them the way they reach any Mixins view.

In the snippets, model, h, Message, and edited are the application's, as in foldkit-richtext-dom's editor; a name such as DraftedLink is one of its own Message constructors.

Install

The foldkit-richtext family is early: 0.x, and its API may change between minor versions.

bash
pnpm add foldkit-mixins-richtext foldkit-mixins foldkit-richtext foldkit-richtext-dom