r105273 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105272‎ | r105273 | r105274 >
Date:01:52, 6 December 2011
Author:neilk
Status:ok
Tags:
Comment:
Revert r104884 "no longer track selections in states. Also makes the 'combine' parameter obsolete"

This reverts git-svn commit e4e3468605c97bd5e611fdf8fc80c04e034e4eb4.
This reverts svn commit r104884
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,8 +63,11 @@
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 ) {
 67+es.SurfaceModel.prototype.select = function( selection, combine ) {
6868 selection.normalize();
 69+ if ( !combine && this.shouldPushState( selection ) ) {
 70+ this.pushState();
 71+ }
6972 // Filter out calls to select if they do not change the selection values
7073 var selectionChanged = !this.selection || (
7174 this.selection.from !== selection.from ||
@@ -77,6 +80,7 @@
7881 selection.from - this.states[this.states.length - 1].from
7982 );
8083 }
 84+ this.currentState.push( selection );
8185 this.selection = selection;
8286 if ( selectionChanged ) {
8387 this.emit( 'select', this.selection.clone() );
Index: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -374,7 +374,7 @@
375375 }
376376 }
377377 // Apply new selection
378 - this.model.select( selection );
 378+ this.model.select( selection, true );
379379 }
380380 };
381381
@@ -517,7 +517,7 @@
518518 this.model.getDocument().getRelativeContentOffset(
519519 this.model.getDocument().getContentLength(), -1
520520 )
521 - ) );
 521+ ), true );
522522 break;
523523 }
524524 // Insert content (maybe)
@@ -575,7 +575,7 @@
576576 }
577577
578578 selection.from = selection.to = targetOffset;
579 - this.model.select( selection );
 579+ this.model.select( selection, true );
580580
581581 if ( sourceNode === targetNode ||
582582 ( typeof sourceSplitableNode !== 'undefined' &&
@@ -610,7 +610,7 @@
611611 tx = this.model.getDocument().prepareRemoval( selection );
612612 this.model.transact( tx, true );
613613 selection.from = selection.to = selection.start;
614 - this.model.select( selection );
 614+ this.model.select( selection, true );
615615 }
616616 };
617617
@@ -662,7 +662,7 @@
663663 selection.from = selection.to =
664664 this.model.getDocument().getRelativeContentOffset( selection.to, 1 );
665665 }
666 - this.model.select( selection );
 666+ this.model.select( selection, true );
667667 };
668668
669669 es.SurfaceView.prototype.insertFromInput = function() {
@@ -702,7 +702,7 @@
703703 // Move the selection
704704 selection.from += val.length;
705705 selection.to += val.length;
706 - this.model.select( selection );
 706+ this.model.select( selection, true );
707707 }
708708 };
709709

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104884no longer track selections in states. Also makes the 'combine' parameter obso...neilk19:08, 1 December 2011

Status & tagging log