Module: @lexical/history
Type Aliases
HistoryOptions
Ƭ HistoryOptions: Object
Type declaration
Name | Type |
---|---|
delay | number |
discardHistory | boolean |
Defined in
lexical-history/src/index.ts:47
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:504
registerHistory
▸ registerHistory(editor
, historyState
, options
): () => 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. |
options | HistoryOptions | - |
Returns
fn
The listeners cleanup callback function.
▸ (): void
Returns
void
Defined in
lexical-history/src/index.ts:393