# 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 configuration object

Returns Object (opens new window)

# 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

# Parameters

  • all (optional, default true)

# Examples

um.undo();

Returns this

# undoAll

Undo all changes

# Examples

um.undoAll();

Returns this

# redo

Redo last change

# Parameters

  • all (optional, default true)

# 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 (opens new window)

# hasRedo

Checks if exists an available redo

# Examples

um.hasRedo();

Returns Boolean (opens new window)

# isRegistered

Check if the entity (Model/Collection) to tracked Note: New Components and CSSRules will be added automatically

# Parameters

  • obj any
  • entity (Model | Collection) Entity to track

Returns Boolean (opens new window)

# getStack

Get stack of changes

# Examples

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

Returns Collection

# skip

Execute the provided callback temporarily stopping tracking changes

# Parameters

# Examples

um.skip(() => {
 // Do stuff without tracking
});

# clear

Clear the stack

# Examples

um.clear();

Returns this