Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -263,6 +263,15 @@ |
264 | 264 | }; |
265 | 265 | |
266 | 266 | es.SurfaceView.prototype.onKeyDown = function( e ) { |
| 267 | + var _this = this; |
| 268 | + function handleInsert() { |
| 269 | + if ( _this.keyboard.keydownTimeout ) { |
| 270 | + clearTimeout( _this.keyboard.keydownTimeout ); |
| 271 | + } |
| 272 | + _this.keyboard.keydownTimeout = setTimeout( function () { |
| 273 | + _this.insertFromInput(); |
| 274 | + }, 10 ); |
| 275 | + } |
267 | 276 | switch ( e.keyCode ) { |
268 | 277 | // Shift |
269 | 278 | case 16: |
— | — | @@ -358,25 +367,33 @@ |
359 | 368 | this.handleEnter(); |
360 | 369 | e.preventDefault(); |
361 | 370 | break; |
| 371 | + // U (soft undo/soft redo) |
| 372 | + case 85: |
| 373 | + if ( e.metaKey || e.ctrlKey ) { |
| 374 | + if ( this.keyboard.keys.shift ) { |
| 375 | + this.model.redo( 1 ); |
| 376 | + } else { |
| 377 | + this.model.undo( 1 ); |
| 378 | + } |
| 379 | + return false; |
| 380 | + } |
| 381 | + handleInsert(); |
| 382 | + break; |
362 | 383 | // Z (undo/redo) |
363 | 384 | case 90: |
364 | 385 | if ( e.metaKey || e.ctrlKey ) { |
365 | 386 | if ( this.keyboard.keys.shift ) { |
366 | | - this.model.redo(); |
| 387 | + this.model.redo( 1, true ); |
367 | 388 | } else { |
368 | | - this.model.undo(); |
| 389 | + this.model.undo( 1, true ); |
369 | 390 | } |
370 | | - break; |
| 391 | + return false; |
371 | 392 | } |
| 393 | + handleInsert(); |
| 394 | + break; |
372 | 395 | // Insert content (maybe) |
373 | 396 | default: |
374 | | - if ( this.keyboard.keydownTimeout ) { |
375 | | - clearTimeout( this.keyboard.keydownTimeout ); |
376 | | - } |
377 | | - var surface = this; |
378 | | - this.keyboard.keydownTimeout = setTimeout( function () { |
379 | | - surface.insertFromInput(); |
380 | | - }, 10 ); |
| 397 | + handleInsert(); |
381 | 398 | break; |
382 | 399 | } |
383 | 400 | return true; |