Skip to main content

Module editor

Module editor 

Source
Expand description

A rich text editor from editor.css, with Prose for rendered rich text.

The markup is Rust; the behaviour is upstream’s own editor.ts, shipped unchanged as JavaScript and bound through DomBridge::bind_editor. Editing is selection work, which upstream keeps out of its Rust models on purpose: where the caret is, what the IME is composing, and how to wrap a selection without collapsing it are questions only the browser can answer. Without a script host the editor stays plain editable text with an inert toolbar.

Re-exports§

pub use Editor_completions::Component::Editor;
pub use Prose_completions::Component::Prose;

Structs§

EditorProps
Properties for the Editor component.
ProseProps
Properties for the Prose component.
TrustedHtml
HTML the application vouches for, the only kind an Editor will render.

Enums§

BlockTag
A block a toolbar button toggles on the paragraph holding the selection.
EditorState
Whether the document is being saved.

Constants§

DEFAULT_MARKS
The marks a default toolbar offers, in upstream’s order.

Functions§

Editor
A rich text editor: a formatting toolbar over an editable document. Toolbar buttons report aria-pressed across the whole selection, so a half-bold selection reads as not bold and a click bolds the rest. The document is reported as HTML through onchange.
Prose
Rendered rich text: headings, lists, quotes, code, and links in upstream’s prose styles.