make sure history state is correct when triggering events

This commit is contained in:
rlx 2013-08-06 19:07:09 +00:00
parent bcb7e3f720
commit 99672fc039

View file

@ -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() {