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: @svgdotjs/svg.js.Element): void call this from within a performOperation function after an element has been added to a markup  
onDelete(elem: @svgdotjs/svg.js.Element): void call this from within a performOperation function before an element is about to be deleted from a markup  
onModified(newElem: @svgdotjs/svg.js.Element, oldElem: @svgdotjs/svg.js.Element): void call this from within a performOperation function after an element has been modified in a markup  
onRepositioned(elem: @svgdotjs/svg.js.Element, oldIndex: number, oldParent: @svgdotjs/svg.js.Element): void call this from within a 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: 14 November, 2024