Skip to main content

@lexical/history

Interfaces

HistoryConfig

Defined in: packages/lexical-history/src/index.ts:518

Properties

createInitialHistoryState()

createInitialHistoryState: (editor) => HistoryState

Defined in: packages/lexical-history/src/index.ts:527

The initial history state, the default is createEmptyHistoryState.

Parameters
editor

LexicalEditor

Returns

HistoryState

delay

delay: number

Defined in: packages/lexical-history/src/index.ts:523

The time (in milliseconds) the editor should delay generating a new history stack, instead of merging the current changes with the current stack. The default is 300ms.

disabled

disabled: boolean

Defined in: packages/lexical-history/src/index.ts:531

Whether history is disabled or not

Type Aliases

HistoryState

HistoryState = object

Defined in: packages/lexical-history/src/index.ts:54

Properties

current

current: null | HistoryStateEntry

Defined in: packages/lexical-history/src/index.ts:55

redoStack

redoStack: HistoryStateEntry[]

Defined in: packages/lexical-history/src/index.ts:56

undoStack

undoStack: HistoryStateEntry[]

Defined in: packages/lexical-history/src/index.ts:57


HistoryStateEntry

HistoryStateEntry = object

Defined in: packages/lexical-history/src/index.ts:50

Properties

editor

editor: LexicalEditor

Defined in: packages/lexical-history/src/index.ts:51

editorState

editorState: EditorState

Defined in: packages/lexical-history/src/index.ts:52

Variables

HistoryExtension

const HistoryExtension: LexicalExtension<HistoryConfig, "@lexical/history/History", NamedSignalsOutput<{ delay: number; disabled: boolean; historyState: HistoryState; }>, unknown>

Defined in: packages/lexical-history/src/index.ts:539

Registers necessary listeners to manage undo/redo history stack and related editor commands, via the @lexical/history module.


SharedHistoryExtension

const SharedHistoryExtension: LexicalExtension<ExtensionConfigBase, "@lexical/history/SharedHistory", unknown, unknown>

Defined in: packages/lexical-history/src/index.ts:576

Registers necessary listeners to manage undo/redo history stack and related editor commands, via the @lexical/history module, only if the parent editor has a history plugin implementation.

Functions

createEmptyHistoryState()

createEmptyHistoryState(): HistoryState

Defined in: packages/lexical-history/src/index.ts:510

Creates an empty history state.

Returns

HistoryState

  • The empty history state, as an object.

registerHistory()

registerHistory(editor, historyState, delay): () => void

Defined in: packages/lexical-history/src/index.ts:404

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

editor

LexicalEditor

The lexical editor.

historyState

HistoryState

The history state, containing the current state and the undo/redo stack.

delay

The time (in milliseconds) the editor should delay generating a new history stack, instead of merging the current changes with the current stack.

number | ReadonlySignal<number>

Returns

The listeners cleanup callback function.

(): void

Returns

void