RichTextUndoState
Manages the undo and redo history for a RichTextState.
This state allows you to programmatically trigger undo, redo, and clearHistory operations, as well as observe the availability of these operations via canUndo and canRedo.
Snapshot Granularity
The undo history is recorded automatically based on the following rules:
Consecutive single-character typing (e.g., typing "abc") is merged into a single undo step.
Whitespace, newlines, text deletions (e.g., Backspace, Delete), and pasting multiple characters always create a separate undo step.