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; }; CustomChange.prototype.execute = function() { 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));
mxUndoableEdit | Implements a composite undoable edit. |
Events | |
mxEvent. | Fires between START_EDIT and END_EDIT after an atomic change was executed. |
mxEvent. | Fires before a set of changes will be executed in undo or redo. |
mxEvent. | Fires after a set of changeswas executed in undo or redo. |
Functions | |
mxUndoableEdit | Constructs a new undoable edit for the given source. |
Variables | |
source | Specifies the source of the edit. |
changes | Array that contains the changes that make up this edit. |
significant | Specifies if the undoable change is significant. |
undone | Specifies if this edit has been undone. |
redone | Specifies if this edit has been redone. |
Functions | |
isEmpty | Returns true if the this edit contains no changes. |
isSignificant | Returns significant. |
add | Adds the specified change to this edit. |
notify | Hook to notify any listeners of the changes after an undo or redo has been carried out. |
die | Hook to free resources after the edit has been removed from the command history. |
undo | Undoes all changes in this edit. |
redo | Redoes all changes in this edit. |
mxUndoableEdit.prototype.isSignificant = function()
Returns significant.
Undoes all changes in this edit.
mxUndoableEdit.prototype.undo = function()
Redoes all changes in this edit.
mxUndoableEdit.prototype.redo = function()
Constructs a new undoable edit for the given source.
function mxUndoableEdit( source, significant )
Specifies the source of the edit.
mxUndoableEdit.prototype.source
Array that contains the changes that make up this edit.
mxUndoableEdit.prototype.changes
Specifies if the undoable change is significant.
mxUndoableEdit.prototype.significant
Specifies if this edit has been undone.
mxUndoableEdit.prototype.undone
Specifies if this edit has been redone.
mxUndoableEdit.prototype.redone
Returns true if the this edit contains no changes.
mxUndoableEdit.prototype.isEmpty = function()
Returns significant.
mxUndoableEdit.prototype.isSignificant = function()
Adds the specified change to this edit.
mxUndoableEdit.prototype.add = function( change )
Hook to notify any listeners of the changes after an undo or redo has been carried out.
mxUndoableEdit.prototype.notify = function()
Hook to free resources after the edit has been removed from the command history.
mxUndoableEdit.prototype.die = function()