Index: trunk/extensions/VisualEditor/modules/es/models/es.SurfaceModel.js |
— | — | @@ -118,12 +118,12 @@ |
119 | 119 | * @param {Integer} Number of document-changing states to reverse |
120 | 120 | */ |
121 | 121 | es.SurfaceModel.prototype.undo = function( transactionsToUndo ) { |
122 | | - /** |
123 | | - * Undo a state. |
124 | | - * @return {Boolean} whether visible change was undone. |
125 | | - */ |
126 | | - function undoState( state ) { |
| 122 | + |
| 123 | + while ( transactionsToUndo ) { |
127 | 124 | var hadTransaction = false; |
| 125 | + |
| 126 | + var state = this.currentState; |
| 127 | + |
128 | 128 | var i = state.length - 1; |
129 | 129 | while ( i-- ) { |
130 | 130 | if ( state[i] instanceof es.TransactionModel ) { |
— | — | @@ -132,11 +132,7 @@ |
133 | 133 | } |
134 | 134 | } |
135 | 135 | this.emit( 'undo', state ); |
136 | | - return hadTransaction; |
137 | | - } |
138 | 136 | |
139 | | - while ( transactionsToUndo ) { |
140 | | - var hadTransaction = undoState( this.currentState ); |
141 | 137 | if ( hadTransaction ) { |
142 | 138 | transactionsToUndo--; |
143 | 139 | } |