Skip to Content
API Referencecorecore/history

@stesura/core/history

The undo history: core’s vendored prosemirror-history, with the same API. Use it in place of prosemirror-history; its undo and redo split bulk edits into chunks, and its transactions carry the history$ meta the editor’s plugins check.

Functions & values

closeHistory

Sets a flag on the transaction that keeps further steps from being appended to an existing history event (so that they require a separate undo command to undo).

Parameters:
NameTypeDefault
trTransaction
Returns:
Transaction

history

The undo history plugin. Set an "addToHistory" meta of false on a transaction to keep undo from rolling it back.

Parameters:
NameTypeDefault
configHistoryOptions
Returns:
Plugin<any>

isHistoryTransaction

Whether the history plugin made this transaction.

Parameters:
NameTypeDefault
trTransaction
Returns:
boolean

redo

Redoes the last undone change, if any.

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

redoDepth

The number of redoable events.

Parameters:
NameTypeDefault
stateEditorState
Returns:
number

redoNoScroll

redo without scrolling the selection into view.

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

undo

Undoes the last change, if any. A large change is undone in chunks: dispatch it through applyWithContinuation.

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

undoDepth

The number of undoable events.

Parameters:
NameTypeDefault
stateEditorState
Returns:
number

undoNoScroll

undo without scrolling the selection into view.

Parameters:
NameTypeDefault
stateEditorState
dispatch(tr: Transaction) => void
viewEditorView
Returns:
boolean

Types

HistoryOptions

NameTypeDefault
depthnumber

The amount of history events that are collected before the oldest events are discarded. Defaults to 100.

newGroupDelaynumber

The delay between changes after which a new group should be started. Defaults to 500 (milliseconds).

Last updated on