Ticket #3662: 3662_2.patch
File 3662_2.patch, 2.0 KB (added by , 15 years ago) |
---|
-
_source/plugins/undo/plugin.js
46 46 canUndo : false 47 47 }); 48 48 49 editor.on( 'resetUndo', function() 50 { 51 // Reset the undo stack. 52 undoManager.reset(); 53 54 // Create the first image. 55 editor.fire( 'saveSnapshot' ); 56 }); 57 49 58 undoManager.onChange = function() 50 59 { 51 60 undoCommand.setState( undoManager.undoable() ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); … … 107 116 label : editor.lang.redo, 108 117 command : 'redo' 109 118 }); 119 120 editor.resetUndo = function() 121 { 122 editor.fire( "resetUndo" ); 123 } 110 124 } 111 125 }); 112 126 … … 166 180 */ 167 181 function UndoManager( editor ) 168 182 { 169 this.typesCount = 0;170 this.modifiersCount = 0;171 172 183 this.editor = editor; 173 184 174 /** 175 * Stack for all the undo and redo snapshots, they're always created/removed 176 * in consistency. 177 */ 178 this.snapshots = []; 179 180 /** 181 * Current snapshot history index. 182 */ 183 this.index = -1; 184 185 this.limit = editor.config.undoStackSize; 186 187 /** 188 * Remember last pressed key. 189 */ 190 this.lastKeystroke = 0; 185 // Reset the undo stack. 186 this.reset(); 191 187 } 192 188 193 189 UndoManager.prototype = … … 288 284 this.typing = true; 289 285 }, 290 286 287 reset : function() // Reset the undo stack. 288 { 289 /** 290 * Remember last pressed key. 291 */ 292 this.lastKeystroke = 0; 293 294 this.modifiersCount = 0; 295 296 this.typesCount = 0; 297 298 /** 299 * Stack for all the undo and redo snapshots, they're always created/removed 300 * in consistency. 301 */ 302 this.snapshots = []; 303 304 /** 305 * Current snapshot history index. 306 */ 307 this.index = -1; 308 309 this.limit = this.editor.config.undoStackSize; 310 311 this.currentImage = null; 312 }, 313 291 314 /** 292 315 * Reset all states about typing. 293 316 * @see UndoManager.type