Class UndoManager

The UndoManager keeps track of all editables.

Hierarchy

  • UndoManager

Constructors

Properties

edits: UndoableEdit[] = []
limit: number
listener: null | (() => void) = null
position: number = 0
unmodifiedPosition: number = 0

Methods

  • Parameters

    • limit: number

    Returns void

  • Returns

    true if there is anything to be redone (only significant edits count)

    Returns boolean

  • Returns

    true if there is anything to be undone (only significant edits count)

    Returns boolean

  • Get the maximum amount of editables to remember

    Returns number

  • Test if there is anything to be saved

    Returns boolean

  • Redo the next significant edit. This will redo all insignificant edits up to the edit to be redone.

    Throws

    Error if no edit can be redone.

    Returns void

  • Set the maximum amount of editables to remember. The new limit will be applied instantly.

    Parameters

    • value: number

      The maximum amount of editables to remember

    Returns void

  • The listener will be called when changes have been done (adding an edit, or undoing/redoing it)

    Parameters

    • listener: null | (() => void)

      The new callback or null to remove the existing one.

    Returns void

  • Mark the point when the data has been saved.

    Returns void

  • Test to see the new position after an redo would happen.

    Returns

    False if no significant edit can be redone. Otherwise the new position.

    Parameters

    • position: number

      The start position

    Returns number | false

  • Test to see the new position after an undo would happen.

    Returns

    False if no significant edit can be undone. Otherwise the new position.

    Parameters

    • position: number

      The start position

    Returns number | false

  • Undo the last significant edit. This will undo all insignificant edits up to the edit to be undone.

    Throws

    Error if no edit can be undone.

    Returns void

Generated using TypeDoc