Class UndoableEdit

Implements a composite undoable edit. Here is an example for a custom change which gets executed via the model:

function CustomChange(model, name)
{
this.model = model;
this.name = name;
this.previous = name;
};

execute = ()=>
{
let tmp = this.model.name;
this.model.name = this.previous;
this.previous = tmp;
};

let name = prompt('Enter name');
graph.model.execute(new CustomChange(graph.model, name));

Event: mxEvent.EXECUTED

Fires between START_EDIT and END_EDIT after an atomic change was executed. The change property contains the change that was executed.

Event: mxEvent.START_EDIT

Fires before a set of changes will be executed in or . This event contains no properties.

Event: mxEvent.END_EDIT

Fires after a set of changeswas executed in or . This event contains no properties.

Constructor: mxUndoableEdit

Constructs a new undoable edit for the given source.

Constructors

Properties

changes: UndoableChange[] = []

Array that contains the changes that make up this edit. The changes are expected to either have an undo and redo function, or an execute function. Default is an empty array.

redone: boolean = false

Specifies if this edit has been redone. Default is false.

significant: boolean = true

Specifies if the undoable change is significant. Default is true.

source: EventSource

Specifies the source of the edit.

undone: boolean = false

Specifies if this edit has been undone. Default is false.

Methods