UndoManager Class

Stores the sequence of operations performed on a Markup. Facilitates undo/redo of the operations.

Methods

Name Description
constructor(): UndoManager    
doRedo(): void reinstate the most recently reversed operation, if any  
doUndo(): void reverse the most recent operation, if any  
onAdded(elem: Element): void call this from within a UndoManager.performOperation function after an element has been added to a markup  
onDelete(elem: Element): void call this from within a UndoManager.performOperation function before an element is about to be deleted from a markup  
onModified(newElem: Element, oldElem: Element): void call this from within a UndoManager.performOperation function after an element has been modified in a markup  
onRepositioned(elem: Element, oldIndex: number, oldParent: Element): void call this from within a UndoManager.performOperation function after an element has been moved in display order in a markup  
performOperation(cmdName: string, fn: VoidFunction): void Perform a series of changes to markup elements that should all be reversed as a single operation.  

Properties

Name Type Description
redoPossible Accessor ReadOnly boolean determine whether there are any reversed operations  
redoString Accessor ReadOnly undefined | string the name of the operation that can be redone (or undefined)  
undoPossible Accessor ReadOnly boolean determine whether there are any un-reversed operations  
undoString Accessor ReadOnly undefined | string the name of the operation that can be undone (or undefined)  

Defined in

Last Updated: 30 November, 2023