States is an array of array of transaction, so one more iteration is needed.

This commit is contained in:
Inez Korczynski 2011-11-21 23:10:31 +00:00
parent 70837a026a
commit 392d911c3d

View file

@ -138,7 +138,9 @@ es.HistoryModel.prototype.undo = function( steps ) {
if ( previousStateIndex > this.currentStateIndex ) {
for ( var i = previousStateIndex; i > this.currentStateIndex; i-- ) {
// Apply transaction to the document
this.doc.rollback( this.states[i] );
for ( var j = this.states[i].length - 1; j >= 0; j-- ) {
this.doc.rollback( this.states[i][j] );
}
// Emit an undo event with the state to be rolled back
this.emit( 'undo', this.states[i] );
}