Skip to main content

Module document

Module document 

Source
Available on crate feature rich-text-editor only.
Expand description

The document model: blocks of styled runs, and the edits made on them.

Everything here is pure, so it can be tested and used without a window. Offsets are byte offsets into a block’s text and always fall on character boundaries.

Structs§

Block
One line of the document: a paragraph, a list item or a quoted line.
Document
A rich text document. It always has at least one block.
Position
A place in the document: a block and a byte offset into its text.
Run
Text in one style.
Selection
The caret and, when text is selected, the other end of the selection.
Style
How a run of text looks.

Enums§

BlockKind
What a block is.
Mark
An inline mark that is either on or off.
Size
A text size, relative to the editor’s base size.

Functions§

normalise_link
Makes address safe to link to: http and https addresses, and mailto for something that looks like an email address. An address without a scheme gets https://. Anything else, such as script, is refused.