r103580 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103579‎ | r103580 | r103581 >
Date:07:52, 18 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Support for "backspace" and "delete" when content is selected - also better support for typing when entire node is selected.
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
@@ -172,8 +172,8 @@
173173 this.mouse.selectingMode = 3; // used in mouseMove handler
174174
175175 var node = this.documentView.getNodeFromOffset( offset );
176 - this.selection.from = this.documentView.getOffsetFromNode( node, false );
177 - this.selection.to = this.selection.from + node.getElementLength() - 1;
 176+ this.selection.from = this.documentView.getOffsetFromNode( node, false ) + 1;
 177+ this.selection.to = this.selection.from + node.getElementLength() - 2;
178178 this.mouse.selectedRange = this.selection.clone();
179179 }
180180
@@ -355,6 +355,12 @@
356356 tx = this.documentView.model.prepareRemoval( range );
357357 this.documentView.model.commit ( tx );
358358 }
 359+ } else {
 360+ var tx = this.documentView.model.prepareRemoval( this.selection );
 361+ this.documentView.model.commit( tx );
 362+ this.documentView.clearSelection();
 363+ this.selection.to = this.selection.from;
 364+ this.showCursor();
359365 }
360366 break;
361367 case 46: // Delete
@@ -393,6 +399,12 @@
394400 tx = this.documentView.model.prepareRemoval( range );
395401 this.documentView.model.commit ( tx );
396402 }
 403+ } else {
 404+ var tx = this.documentView.model.prepareRemoval( this.selection );
 405+ this.documentView.model.commit( tx );
 406+ this.documentView.clearSelection();
 407+ this.selection.to = this.selection.from;
 408+ this.showCursor();
397409 }
398410 break;
399411 case 13: // Enter

Status & tagging log