r105716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105715‎ | r105716 | r105717 >
Date:20:56, 9 December 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Update the preview panes when loading different documents
Modified paths:
  • /trunk/extensions/VisualEditor/modules/sandbox/sandbox.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/sandbox/sandbox.js
@@ -472,30 +472,6 @@
473473 window.contextView = new es.ContextView( window.surfaceView );
474474 window.surfaceModel.select( new es.Range( 1, 1 ) );
475475
476 - var $docsList = $( '#es-docs-list' );
477 - $.each( wikidoms, function( title, wikidom ) {
478 - $docsList.append(
479 - $( '<li class="es-docs-listItem"></li>' )
480 - .append(
481 - $( '<a href="#"></a>' )
482 - .text( title )
483 - .click( function() {
484 - var newDocumentModel = es.DocumentModel.newFromPlainObject( wikidom );
485 - documentModel.data.splice( 0, documentModel.data.length );
486 - es.insertIntoArray( documentModel.data, 0, newDocumentModel.data );
487 - surfaceModel.select( new es.Range( 1, 1 ) );
488 - documentModel.splice.apply(
489 - documentModel,
490 - [0, documentModel.getChildren().length]
491 - .concat( newDocumentModel.getChildren() )
492 - );
493 - surfaceModel.purgeHistory();
494 - return false;
495 - } )
496 - )
497 - );
498 - } );
499 -
500476 var $modeButtons = $( '.es-modes-button' ),
501477 $panels = $( '.es-panel' ),
502478 $base = $( '#es-base' ),
@@ -603,6 +579,33 @@
604580 } );
605581 } );
606582
 583+ var $docsList = $( '#es-docs-list' );
 584+ $.each( wikidoms, function( title, wikidom ) {
 585+ $docsList.append(
 586+ $( '<li class="es-docs-listItem"></li>' )
 587+ .append(
 588+ $( '<a href="#"></a>' )
 589+ .text( title )
 590+ .click( function() {
 591+ var newDocumentModel = es.DocumentModel.newFromPlainObject( wikidom );
 592+ documentModel.data.splice( 0, documentModel.data.length );
 593+ es.insertIntoArray( documentModel.data, 0, newDocumentModel.data );
 594+ surfaceModel.select( new es.Range( 1, 1 ) );
 595+ documentModel.splice.apply(
 596+ documentModel,
 597+ [0, documentModel.getChildren().length]
 598+ .concat( newDocumentModel.getChildren() )
 599+ );
 600+ surfaceModel.purgeHistory();
 601+
 602+ if ( currentMode ) {
 603+ currentMode.update.call( currentMode );
 604+ }
 605+ return false;
 606+ } )
 607+ )
 608+ );
 609+ } );
607610
608611 surfaceModel.on( 'transact', function() {
609612 if ( currentMode ) {

Status & tagging log