r102078 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102077‎ | r102078 | r102079 >
Date:00:59, 5 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Support for deleting text with backspace and delete
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
@@ -195,8 +195,14 @@
196196 this.moveCursor( 'down' );
197197 break;
198198 case 8: // Backspace
 199+ var transaction = this.documentView.model.prepareRemoval( new es.Range( this.selection.to, this.selection.to - 1 ) );
 200+ this.documentView.model.commit ( transaction );
 201+ this.selection.from = this.selection.to -= 1;
 202+ this.showCursor();
199203 break;
200204 case 46: // Delete
 205+ var transaction = this.documentView.model.prepareRemoval( new es.Range( this.selection.to, this.selection.to + 1 ) );
 206+ this.documentView.model.commit ( transaction );
201207 break;
202208 default: // Insert content (maybe)
203209 if ( this.keyboard.keydownTimeout ) {
@@ -217,7 +223,7 @@
218224 if ( val.length > 0 ) {
219225 var transaction = this.documentView.model.prepareInsertion( this.selection.to, val.split('') );
220226 this.documentView.model.commit ( transaction );
221 - this.selection.to += val.length;
 227+ this.selection.from = this.selection.to += val.length;
222228 this.showCursor();
223229 }
224230 };

Status & tagging log