Skip to content

Type Editor


Type Editor / @type-editor/history / helper/undo-depth

helper/undo-depth

Functions

FunctionDescription

undoDepth

Returns the number of undoable events available in the editor's history.

This can be used to determine whether the undo command is available, or to display the undo history depth in the UI.

Example

typescript
const canUndo = undoDepth(state) > 0;
console.log(`You can undo ${undoDepth(state)} changes`);