Module: @lexical/history
Type Aliases
HistoryState
Ƭ HistoryState: Object
Type declaration
Name | Type |
---|---|
current | null | HistoryStateEntry |
redoStack | HistoryStateEntry [] |
undoStack | HistoryStateEntry [] |
Defined in
lexical-history/src/index.ts:42
HistoryStateEntry
Ƭ HistoryStateEntry: Object
Type declaration
Name | Type |
---|---|
editor | LexicalEditor |
editorState | EditorState |
Defined in
lexical-history/src/index.ts:38
Functions
createEmptyHistoryState
▸ createEmptyHistoryState(): HistoryState
Creates an empty history state.
Returns
- The empty history state, as an object.
Defined in
lexical-history/src/index.ts:500
registerHistory
▸ registerHistory(editor
, historyState
, delay
): () => void
Registers necessary listeners to manage undo/redo history stack and related editor commands.
It returns unregister
callback that cleans up all listeners and should be called on editor unmount.
Parameters
Name | Type | Description |
---|---|---|
editor | LexicalEditor | The lexical editor. |
historyState | HistoryState | The history state, containing the current state and the undo/redo stack. |
delay | number | The time (in milliseconds) the editor should delay generating a new history stack, instead of merging the current changes with the current stack. |
Returns
fn
The listeners cleanup callback function.
▸ (): void
Returns
void