This module allows to manage the stack of changes applied in canvas. Once the editor is instantiated you can use its API. Before using these methods you should get the module from the instance
const um = editor.UndoManager;
Get configuration object
Returns Object
Add an entity (Model/Collection) to track Note: New Components and CSSRules will be added automatically
entity
(Model | Collection) Entity to track
um.add(someModelOrCollection);
Returns this
Remove and stop tracking the entity (Model/Collection)
entity
(Model | Collection) Entity to remove
um.remove(someModelOrCollection);
Returns this
Remove all entities
um.removeAll();
Returns this
Start/resume tracking changes
um.start();
Returns this
Stop tracking changes
um.stop();
Returns this
Undo last change
all
(optional, defaulttrue
)
um.undo();
Returns this
Undo all changes
um.undoAll();
Returns this
Redo last change
all
(optional, defaulttrue
)
um.redo();
Returns this
Redo all changes
um.redoAll();
Returns this
Checks if exists an available undo
um.hasUndo();
Returns Boolean
Checks if exists an available redo
um.hasRedo();
Returns Boolean
Check if the entity (Model/Collection) to tracked Note: New Components and CSSRules will be added automatically
obj
anyentity
(Model | Collection) Entity to track
Returns Boolean
Get stack of changes
const stack = um.getStack();
stack.each(item => ...);
Returns Collection
Execute the provided callback temporarily stopping tracking changes
clb
Function The callback to execute with changes tracking stopped
um.skip(() => {
// Do stuff without tracking
});
Clear the stack
um.clear();
Returns this