Comment on page
HistoryEditor
The
HistoryEditor
interface is added to the Editor
when it is instantiated using the withHistory
method.const [editor] = useState(() => withReact(withHistory(createEditor())))
This adds properties to
editor
that enables undo and redo in Slate.There are also static methods for working with the Editor's undo/redo history.
export interface HistoryEditor extends BaseEditor {
history: History
undo: () => void
redo: () => void
writeHistory: (stack: 'undos' | 'redos', batch: any) => void
}
Redo to the next saved state.
Undo to the previous saved state.
Apply a series of changes inside a synchronous
fn
, without merging any of the new operations into previous save point in the history.Apply a series of changes inside a synchronous
fn
, without saving any of their operations into the history.Check if a value is a
HistoryEditor
(i.e. it has the HistoryEditor
interface).Get the merge flag's current value.
Get the saving flag's current value.
Undo the last batch of operations
Redo the last undone batch of operations
Push a batch of operations as either
undos
or redos
onto editor.undos
or editor.redos
Last modified 7mo ago