UndoManager

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;

getConfig

Get module configurations

Examples

const config = um.getConfig();
// { ... }

Returns Object Configuration object

add

Add an entity (Model/Collection) to track Note: New Components and CSSRules will be added automatically

Parameters

  • entity(Model | Collection) Entity to track

Examples

um.add(someModelOrCollection);

Returns this

remove

Remove and stop tracking the entity (Model/Collection)

Parameters

  • entity(Model | Collection) Entity to remove

Examples

um.remove(someModelOrCollection);

Returns this

removeAll

Remove all entities

Examples

um.removeAll();

Returns this

start

Start/resume tracking changes

Examples

um.start();

Returns this

stop

Stop tracking changes

Examples

um.stop();

Returns this

undo

Undo last change

Examples

um.undo();

Returns this

undoAll

Undo all changes

Examples

um.undoAll();

Returns this

redo

Redo last change

Examples

um.redo();

Returns this

redoAll

Redo all changes

Examples

um.redoAll();

Returns this

hasUndo

Checks if exists an available undo

Examples

um.hasUndo();

Returns Boolean

hasRedo

Checks if exists an available redo

Examples

um.hasRedo();

Returns Boolean

getStack

Get stack of changes

Examples

const stack = um.getStack();
stack.each(item => ...);

Returns Collection

clear

Clear the stack

Examples

um.clear();

Returns this

Last Updated: 7/9/2018, 12:11:12 AM