Expand description
Text Input Manager
Centralizes all text editing logic for contenteditable nodes.
This manager handles text input from multiple sources:
- Keyboard input (character insertion, backspace, etc.)
- IME composition (multi-character input for Asian languages)
- Accessibility actions (screen readers, voice control)
- Programmatic edits (from callbacks)
§Architecture
The text input system uses a two-phase approach:
-
Record Phase: When text input occurs, record what changed (old_text + inserted_text)
- Store in
pending_changeset - Do NOT modify any caches yet
- Return affected nodes so callbacks can be invoked
- Store in
-
Apply Phase: After callbacks, if preventDefault was not set:
- Compute new text using text3::edit
- Update cursor position
- Update text cache
- Mark nodes dirty for re-layout
This separation allows:
- User callbacks to inspect the changeset before it’s applied
- preventDefault to cancel the edit
- Consistent behavior across keyboard/IME/A11y sources
Structs§
- Pending
Text Edit - Information about a pending text edit that hasn’t been applied yet
- Text
Input Manager - Text Input Manager
Enums§
- Option
Pending Text Edit - C-compatible Option type for PendingTextEdit
- Text
Input Source - Source of a text input event