0.12.2 • Published 8 months ago

@paiondata/lexical-history v0.12.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@paiondata/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,
): () => void

Commands

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 'lexical';

<Toolbar>
  <Button onClick={() => editor.dispatchCommand(UNDO_COMMAND)}>Undo</Button>
  <Button onClick={() => editor.dispatchCommand(REDO_COMMAND)}>Redo</Button>
</Toolbar>;
1.12.15

8 months ago

1.12.9

8 months ago

1.12.8

8 months ago

1.12.7

8 months ago

1.12.6

8 months ago

1.12.5

8 months ago

1.12.3

8 months ago

1.12.2

8 months ago

0.12.3

8 months ago

0.12.2

8 months ago