0.11.1-mod8 • Published 2 years ago
@meogic/lexical-history v0.11.1-mod8
@meogic/lexical-history
This package contains history helpers for Lexical.
Methods
registerHistory
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.
function registerHistory(
editor: LexicalEditor,
externalHistoryState: HistoryState,
delay: number,
): () => voidCommands
History package handles UNDO_COMMAND, REDO_COMMAND and CLEAR_HISTORY_COMMAND commands. It also triggers CAN_UNDO_COMMAND and CAN_REDO_COMMAND commands when history state is changed. These commands could be used to work with history state:
import {UNDO_COMMAND, REDO_COMMAND} from '@meogic/lexical';
<Toolbar>
<Button onClick={() => editor.dispatchCommand(UNDO_COMMAND)}>Undo</Button>
<Button onClick={() => editor.dispatchCommand(REDO_COMMAND)}>Redo</Button>
</Toolbar>;0.11.1-mod8
2 years ago
0.11.1-mod7
2 years ago
0.11.1-mod6
3 years ago
0.11.1-mod5
3 years ago
0.11.1-mod4
3 years ago
0.11.1-mod3
3 years ago
0.11.1-mod2
3 years ago
0.11.1-mod1
3 years ago