r104884 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104883‎ | r104884 | r104885 >
Date:19:08, 1 December 2011
Author:neilk
Status:reverted
Tags:
Comment:
no longer track selections in states. Also makes the 'combine' parameter obsolete
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/models/es.SurfaceModel.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/models/es.SurfaceModel.js
@@ -63,11 +63,8 @@
6464 * @param {es.Range} selection
6565 * @param {Boolean} combine Whether to prevent this transaction from causing a state push
6666 */
67 -es.SurfaceModel.prototype.select = function( selection, combine ) {
 67+es.SurfaceModel.prototype.select = function( selection ) {
6868 selection.normalize();
69 - if ( !combine && this.shouldPushState( selection ) ) {
70 - this.pushState();
71 - }
7269 // Filter out calls to select if they do not change the selection values
7370 var selectionChanged = !this.selection || (
7471 this.selection.from !== selection.from ||
@@ -80,7 +77,6 @@
8178 selection.from - this.states[this.states.length - 1].from
8279 );
8380 }
84 - this.currentState.push( selection );
8581 this.selection = selection;
8682 if ( selectionChanged ) {
8783 this.emit( 'select', this.selection.clone() );
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -323,7 +323,7 @@
324324 }
325325 }
326326 // Apply new selection
327 - this.model.select( selection, true );
 327+ this.model.select( selection );
328328 }
329329 };
330330
@@ -462,7 +462,7 @@
463463 this.model.getDocument().getRelativeContentOffset(
464464 this.model.getDocument().getContentLength(), -1
465465 )
466 - ), true );
 466+ ) );
467467 break;
468468 }
469469 // Insert content (maybe)
@@ -518,7 +518,7 @@
519519 }
520520
521521 selection.from = selection.to = targetOffset;
522 - this.model.select( selection, true );
 522+ this.model.select( selection );
523523
524524 if ( sourceNode === targetNode ||
525525 ( typeof sourceSplitableNode !== 'undefined' &&
@@ -552,7 +552,7 @@
553553 tx = this.model.getDocument().prepareRemoval( selection );
554554 this.model.transact( tx, true );
555555 selection.from = selection.to = selection.start;
556 - this.model.select( selection, true );
 556+ this.model.select( selection );
557557 }
558558 };
559559
@@ -603,7 +603,7 @@
604604 selection.from = selection.to =
605605 this.model.getDocument().getRelativeContentOffset( selection.to, 1 );
606606 }
607 - this.model.select( selection, true );
 607+ this.model.select( selection );
608608 };
609609
610610 es.SurfaceView.prototype.insertFromInput = function() {
@@ -627,7 +627,7 @@
628628
629629 selection.from += val.length;
630630 selection.to += val.length;
631 - this.model.select( selection, true );
 631+ this.model.select( selection );
632632 }
633633 };
634634
@@ -811,4 +811,4 @@
812812
813813 /* Inheritance */
814814
815 -es.extendClass( es.SurfaceView, es.EventEmitter );
\ No newline at end of file
 815+es.extendClass( es.SurfaceView, es.EventEmitter );

Follow-up revisions

RevisionCommit summaryAuthorDate
r105273Revert r104884 "no longer track selections in states. Also makes the 'combine...neilk01:52, 6 December 2011

Status & tagging log