Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UndoManager

Manager class returned by undoMiddleware that allows you to perform undo/redo actions.

Hierarchy

  • UndoManager

Index

Constructors

Properties

store: UndoStore

The store currently being used to store undo/redo action events.

Accessors

  • get canRedo(): boolean
  • If redo can be performed (if there is at least one redo action available)

    Returns boolean

  • get canUndo(): boolean
  • If undo can be performed (if there is at least one undo action available).

    Returns boolean

  • get isUndoRecordingDisabled(): boolean
  • Returns if undo recording is currently disabled or not for this particular UndoManager.

    Returns boolean

  • get redoLevels(): number
  • The number of redo actions available.

    Returns number

  • The redo stack, where the first operation to redo will be the last of the array. Do not manipulate this array directly.

    Returns readonly UndoEvent[]

  • get undoLevels(): number
  • The number of undo actions available.

    Returns number

  • The undo stack, where the first operation to undo will be the last of the array. Do not manipulate this array directly.

    Returns readonly UndoEvent[]

Methods

  • clearRedo(): void
  • Clears the redo queue.

    Returns void

  • clearUndo(): void
  • Clears the undo queue.

    Returns void

  • createGroup(groupName?: string): { continue: any; end: any }
  • Creates a custom group that can be continued multiple times and then ended.

    Parameters

    • Optional groupName: string

      Optional group name.

    Returns { continue: any; end: any }

    An API to continue/end the group.

    • continue:function
      • continue<T>(fn: () => T): T
      • Type parameters

        • T

        Parameters

        • fn: () => T
            • (): T
            • Returns T

        Returns T

    • end:function
      • end(): void
      • Returns void

  • dispose(): void
  • Disposes the undo middleware.

    Returns void

  • redo(): void
  • Redoes the previous action. Will throw if there is no action to redo.

    Returns void

  • undo(): void
  • Undoes the last action. Will throw if there is no action to undo.

    Returns void

  • withGroup<T>(groupName: string, fn: () => T): T
  • withGroup<T>(fn: () => T): T
  • Runs a synchronous code block as an undo group. Note that nested groups are allowed.

    Type parameters

    • T

    Parameters

    • groupName: string

      Group name.

    • fn: () => T

      Code block.

        • (): T
        • Returns T

    Returns T

    Code block return value.

  • Runs a synchronous code block as an undo group. Note that nested groups are allowed.

    Type parameters

    • T

    Parameters

    • fn: () => T

      Code block.

        • (): T
        • Returns T

    Returns T

    Code block return value.

  • withGroupFlow<R>(groupName: string, fn: () => Generator<any, R, any>): Promise<R>
  • withGroupFlow<R>(fn: () => Generator<any, R, any>): Promise<R>
  • Runs an asynchronous code block as an undo group. Note that nested groups are allowed.

    Type parameters

    • R

    Parameters

    • groupName: string

      Group name.

    • fn: () => Generator<any, R, any>

      Flow function.

        • (): Generator<any, R, any>
        • Returns Generator<any, R, any>

    Returns Promise<R>

    Flow function return value.

  • Runs an asynchronous code block as an undo group. Note that nested groups are allowed.

    Type parameters

    • R

    Parameters

    • fn: () => Generator<any, R, any>

      Flow function.

        • (): Generator<any, R, any>
        • Returns Generator<any, R, any>

    Returns Promise<R>

    Flow function return value.

  • withoutUndo<T>(fn: () => T): T
  • Skips the undo recording mechanism for the code block that gets run synchronously inside.

    Type parameters

    • T

      Code block return type.

    Parameters

    • fn: () => T

      Code block to run.

        • (): T
        • Returns T

    Returns T

    The value returned by the code block.

Generated using TypeDoc