Ticket #3372: 3372_3.patch
File 3372_3.patch, 1.7 KB (added by , 15 years ago) |
---|
-
_source/plugins/undo/plugin.js
10 10 11 11 (function() 12 12 { 13 var modifierCodes = { 8:1, 46:1/*, 39:1, 40:1, 38:1, 37:1*/ }; 13 14 CKEDITOR.plugins.add( 'undo', 14 15 { 15 16 requires : [ 'selection', 'wysiwygarea' ], … … 82 83 { 83 84 // Do not capture CTRL hotkeys. 84 85 if ( !event.data.$.ctrlKey && !event.data.$.metaKey ) 85 undoManager.type( );86 undoManager.type( event ); 86 87 }); 87 88 88 89 // Being this the first call, let's get an undo snapshot. … … 182 183 this.index = -1; 183 184 184 185 this.limit = editor.config.undoStackSize; 186 187 /** 188 * Remember last pressed key. 189 */ 190 this.lastKeystroke = 0; 185 191 } 186 192 187 193 UndoManager.prototype = 188 194 { 189 type : function() 195 /** 196 * 197 * @param {CKEDITOR.dom.event} [event] 198 */ 199 type : function( event ) 190 200 { 191 if ( !this.typing ) 201 var keystroke = event && event.data.getKeystroke(), 202 isModifier = keystroke in modifierCodes, 203 lastWasSameModifier = isModifier && keystroke == this.lastKeystroke, 204 modifierSnapshot = isModifier && !lastWasSameModifier; 205 206 if ( !this.typing || modifierSnapshot ) 192 207 { 193 208 var beforeTypeImage = new Image( this.editor ); 194 209 … … 219 234 this.onChange(); 220 235 } 221 236 }, 222 0, this ); 237 0, this 238 ); 223 239 224 return; 240 if ( !modifierSnapshot ) 241 return; 225 242 } 226 243 227 244 this.typesCount++; … … 233 250 } 234 251 235 252 this.typing = true; 253 this.lastKeystroke = keystroke; 236 254 }, 237 255 238 256 fireChange : function()