Creates a new UndoManager instance
An event that fires whenever the undoStack of this UndoManager changes.
An event that fires whenever the redoStack of this UndoManager changes.
An event that fires whenever the limit of this UndoManager changes.
Returns the current limit of the UndoManager
This limits the size of the undoStack. If the size of the undoStack exceeds the limit, the oldest Undoables on the stack are removed.
If the new limit is lower than the old limit, the oldest items on the undoStack will be discarded, without applying them.
Sets the limit of the UndoManager.
This limits the size of the undoStack. If the size of the undoStack exceeds the limit, the oldest Undoables on the stack are removed.
If the new limit is lower than the old limit, the oldest items on the undoStack will be discarded, without applying them.
The new limit. Must be strictly positive.
Returns a copy of the redo stack. The upcoming undoable is the last element in the array.
You can use this stack to show one or more upcoming undoables, for example in a drop-down box of a redo button.
Returns a copy of the undo stack. The upcoming undoable is the last element in the array.
You can use this stack to show one or more upcoming undoables, for example in a drop-down box of an undo button.
Redoes the last Undoable on the redoStack. This Undoable then moves to the undoStack. If an error is thrown in Undoable.redo, the error is propagated back to the caller of UndoManager.redo. The Undoable still moves to the undoStack.
Undoes the last Undoable on the undoStack. This Undoable then moves to the redoStack. If an error is thrown in Undoable.undo, the error is propagated back to the caller of UndoManager.undo. The Undoable still moves to the redoStack.
A manager of Undoables.
You can add Undoables to this manager, which will maintain a stack of undoables that you can undo or redo.
You can wire a keyboard shortcut, like CTRL+Z to undo, as follows:
You usually create undoables in response to an event from the API, and then add them to an UndoManager. You can find a list of common events in Undoable.
This example shows how to create Undoables in LuciadRIA:
You can find the full source, and more examples, in
samples/common/util/SampleUndoSupport.ts
.See the Adding undo/redo support to your application guide for more information on how to work with undo/redo in LuciadRIA.
Undoable
2022.1