make sure history state is correct when triggering events
This commit is contained in:
parent
bcb7e3f720
commit
99672fc039
1 changed files with 4 additions and 2 deletions
|
@ -40,8 +40,9 @@ Ox.History = function(options) {
|
||||||
},
|
},
|
||||||
redo: function() {
|
redo: function() {
|
||||||
if (position < history.length) {
|
if (position < history.length) {
|
||||||
|
position++;
|
||||||
$element && $element.triggerEvent('redo');
|
$element && $element.triggerEvent('redo');
|
||||||
return history[position++];
|
return history[position - 1];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
redoText: function() {
|
redoText: function() {
|
||||||
|
@ -57,8 +58,9 @@ Ox.History = function(options) {
|
||||||
},
|
},
|
||||||
undo: function() {
|
undo: function() {
|
||||||
if (position > 0) {
|
if (position > 0) {
|
||||||
|
position--;
|
||||||
$element && $element.triggerEvent('undo');
|
$element && $element.triggerEvent('undo');
|
||||||
return history[--position];
|
return history[position];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
undoText: function() {
|
undoText: function() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue