Index: trunk/extensions/VisualEditor/modules/sandbox/sandbox.js |
— | — | @@ -472,30 +472,6 @@ |
473 | 473 | window.contextView = new es.ContextView( window.surfaceView ); |
474 | 474 | window.surfaceModel.select( new es.Range( 1, 1 ) ); |
475 | 475 | |
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 | | - |
500 | 476 | var $modeButtons = $( '.es-modes-button' ), |
501 | 477 | $panels = $( '.es-panel' ), |
502 | 478 | $base = $( '#es-base' ), |
— | — | @@ -603,6 +579,33 @@ |
604 | 580 | } ); |
605 | 581 | } ); |
606 | 582 | |
| 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 | + } ); |
607 | 610 | |
608 | 611 | surfaceModel.on( 'transact', function() { |
609 | 612 | if ( currentMode ) { |