r103573 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103572‎ | r103573 | r103574 >
Date:05:51, 18 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Start from removing selected content if there is any when typing
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
@@ -354,9 +354,15 @@
355355 var val = this.$input.val();
356356 this.$input.val( '' );
357357 if ( val.length > 0 ) {
358 - var transaction = this.documentView.model.prepareInsertion( this.selection.to, val.split('') );
359 - this.documentView.model.commit ( transaction );
360 - this.selection.from = this.selection.to += val.length;
 358+ if ( this.selection.from != this.selection.to ) {
 359+ var tx = this.documentView.model.prepareRemoval( this.selection );
 360+ this.documentView.model.commit( tx );
 361+ this.documentView.clearSelection();
 362+ }
 363+
 364+ var tx = this.documentView.model.prepareInsertion( this.selection.from, val.split('') );
 365+ this.documentView.model.commit ( tx );
 366+ this.selection.to = this.selection.from += val.length;
361367 this.showCursor();
362368 }
363369 };

Status & tagging log