Undo and redo for the editor: snapshots of the document with a label.
Edits of the same field that follow each other quickly (typing in an input) are merged into one step, so undo goes back a whole word and not a letter.
Summary
Functions
Whether there is something to redo.
Whether there is something to undo.
An empty history.
Records previous (the document before a change) under label. key
identifies the edited field: consecutive changes with the same key within
1500 ms are merged.
Goes one step forward. Returns {:ok, document, history} or :error.
Jumps to step index of past (0 is the most recent), keeping the steps in
between as redo steps.
Goes one step back. Returns {:ok, document, history} or :error.
Types
Functions
Whether there is something to redo.
Whether there is something to undo.
An empty history.
Records previous (the document before a change) under label. key
identifies the edited field: consecutive changes with the same key within
1500 ms are merged.
Goes one step forward. Returns {:ok, document, history} or :error.
@spec restore(t(), map(), non_neg_integer()) :: {:ok, map(), t()} | :error
Jumps to step index of past (0 is the most recent), keeping the steps in
between as redo steps.
Goes one step back. Returns {:ok, document, history} or :error.