r105398 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105397‎ | r105398 | r105399 >
Date:00:51, 7 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Fixed cut - now cut copy and paste work
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -108,6 +108,15 @@
109109 },
110110 'keyup.es-surfaceView': function( e ) {
111111 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 );
112121 }
113122 } );
114123 },
@@ -414,16 +423,26 @@
415424 }
416425 };
417426
 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+
418445 es.SurfaceView.prototype.onKeyDown = function( e ) {
419446 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 - }
428447 switch ( e.keyCode ) {
429448 // Shift
430449 case 16:
@@ -555,7 +574,7 @@
556575 }
557576 }
558577 // Regular text insertion
559 - handleInsert();
 578+ this.handleInsert();
560579 break;
561580 }
562581 return true;
@@ -570,6 +589,16 @@
571590 }
572591 };
573592
 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+
574603 es.SurfaceView.prototype.handleDelete = function( backspace, isPartial ) {
575604 var selection = this.currentSelection.clone(),
576605 sourceOffset,

Status & tagging log