summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJitesh Kumar Jha2016-06-10 11:11:07 +0530
committerGitHub2016-06-10 11:11:07 +0530
commit97538b089128001ae1d9deb0d437b0d0b67f0c35 (patch)
treebd559e04a0eff12f75d69f2bd6f077d66bd6c5ff
parent679ad3cd87015ad8332955821bcd07c381440691 (diff)
downloadxcos-on-web-97538b089128001ae1d9deb0d437b0d0b67f0c35.tar.gz
xcos-on-web-97538b089128001ae1d9deb0d437b0d0b67f0c35.tar.bz2
xcos-on-web-97538b089128001ae1d9deb0d437b0d0b67f0c35.zip
Update mxUndomanager comments
-rw-r--r--index.html14
1 files changed, 14 insertions, 0 deletions
diff --git a/index.html b/index.html
index 04f4504..c97b0a5 100644
--- a/index.html
+++ b/index.html
@@ -183,15 +183,29 @@
else if(source.value = "CommandPort") {
alert("Command port must be connected to control port");
}
+
+ /*
+ Remove last mxEvent from the undoManager history stack,
+ Store all the remaining undo mxEvents into a temporary array,
+ clears the history, and readds the mxEvents into the undoManager history stack.
+ */
editor.execute('undo');
+
+ // Remove the last element from the history array.
undoManager.history.splice(-1,1);
+
+ // storage[] -> temporary array
var storage = [];
for(i in undoManager.history) {
if(undoManager.history[i] != null) {
storage.push(undoManager.history[i])
}
}
+
+ // Clear the undoManager history, and reset the undoManager pointer to avoid any undo of null events.
undoManager.clear();
+
+ // Move the remaning mxEvents back into the undoManager history stack.
for(i in storage) {
if(storage[i] != null) {
undoManager.undoableEditHappened(storage[i]);