• English
  • UndoManager

    Undo/redo manager providing YJS-based undo and redo functionality, with support for stack management and history clearing.

    Methods

    constructor

    Constructor

    Definition:

    constructor(scope: any)

    Parameters:

    ParameterTypeDescription
    scopeany- YJS document or type scope, used to define the tracking range for undo/redo

    undo

    Undoes the last modification.

    Definition:

    undo(): boolean

    Returns: boolean

    redo

    Redoes an undone modification.

    Definition:

    redo(): boolean

    Returns: boolean

    canUndo

    Checks whether there are operations that can be undone.

    Definition:

    canUndo(): boolean

    Returns: boolean

    canRedo

    Checks whether there are operations that can be redone.

    Definition:

    canRedo(): boolean

    Returns: boolean

    clear

    Clears the history.

    Definition:

    clear(clearUndoStack?: boolean, clearRedoStack?: boolean): void

    Returns: void

    Parameters:

    ParameterTypeDescription
    clearUndoStack?boolean- Whether to clear the undo stack, defaults to true
    clearRedoStack?boolean- Whether to clear the redo stack, defaults to true