Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js |
— | — | @@ -108,6 +108,15 @@ |
109 | 109 | }, |
110 | 110 | 'keyup.es-surfaceView': function( e ) { |
111 | 111 | return _this.onKeyUp( e ); |
| 112 | + }, |
| 113 | + 'copy.es-surfaceView': function( e ) { |
| 114 | + return _this.onCopy( e ); |
| 115 | + }, |
| 116 | + 'cut.es-surfaceView': function( e ) { |
| 117 | + return _this.onCut( e ); |
| 118 | + }, |
| 119 | + 'paste.es-surfaceView': function( e ) { |
| 120 | + return _this.onPaste( e ); |
112 | 121 | } |
113 | 122 | } ); |
114 | 123 | }, |
— | — | @@ -414,16 +423,26 @@ |
415 | 424 | } |
416 | 425 | }; |
417 | 426 | |
| 427 | +es.SurfaceView.prototype.onCopy = function( e ) { |
| 428 | + // TODO: Keep a data copy around |
| 429 | + return true; |
| 430 | +}; |
| 431 | + |
| 432 | +es.SurfaceView.prototype.onCut = function( e ) { |
| 433 | + var _this = this; |
| 434 | + setTimeout( function() { |
| 435 | + _this.handleDelete(); |
| 436 | + }, 10 ); |
| 437 | + return true; |
| 438 | +}; |
| 439 | + |
| 440 | +es.SurfaceView.prototype.onPaste = function( e ) { |
| 441 | + // TODO: Check if the data copy is the same as what got pasted, and use that instead if so |
| 442 | + return true; |
| 443 | +}; |
| 444 | + |
418 | 445 | es.SurfaceView.prototype.onKeyDown = function( e ) { |
419 | 446 | var _this = this; |
420 | | - function handleInsert() { |
421 | | - if ( _this.keyboard.keydownTimeout ) { |
422 | | - clearTimeout( _this.keyboard.keydownTimeout ); |
423 | | - } |
424 | | - _this.keyboard.keydownTimeout = setTimeout( function () { |
425 | | - _this.insertFromInput(); |
426 | | - }, 10 ); |
427 | | - } |
428 | 447 | switch ( e.keyCode ) { |
429 | 448 | // Shift |
430 | 449 | case 16: |
— | — | @@ -555,7 +574,7 @@ |
556 | 575 | } |
557 | 576 | } |
558 | 577 | // Regular text insertion |
559 | | - handleInsert(); |
| 578 | + this.handleInsert(); |
560 | 579 | break; |
561 | 580 | } |
562 | 581 | return true; |
— | — | @@ -570,6 +589,16 @@ |
571 | 590 | } |
572 | 591 | }; |
573 | 592 | |
| 593 | +es.SurfaceView.prototype.handleInsert = function() { |
| 594 | + var _this = this; |
| 595 | + if ( _this.keyboard.keydownTimeout ) { |
| 596 | + clearTimeout( _this.keyboard.keydownTimeout ); |
| 597 | + } |
| 598 | + _this.keyboard.keydownTimeout = setTimeout( function () { |
| 599 | + _this.insertFromInput(); |
| 600 | + }, 10 ); |
| 601 | +}; |
| 602 | + |
574 | 603 | es.SurfaceView.prototype.handleDelete = function( backspace, isPartial ) { |
575 | 604 | var selection = this.currentSelection.clone(), |
576 | 605 | sourceOffset, |