Cleanup Sanxbox.js

Change-Id: Id8ba1aacecdbb5d31888e289d23ab03a16346c60
This commit is contained in:
Rob Moen 2012-05-21 17:03:57 -07:00
parent 95e06e96bf
commit 0b9411c531
3 changed files with 5 additions and 41 deletions

View file

@ -1,9 +1,4 @@
<!-- VisualEditor Sandbox -->
<div id="es-warning" class="es-warning">WARNING: This an experimental deployment of the current visual editor codebase. It is still highly unstable and should be expected to break at any time.
<a href="#" id="es-warning-dismiss">Dismiss</a></div>
<div id="es-docs" style="visibility: hidden">
<div id="es-docs-label">Example documents:</div>
<ul id="es-docs-list" ></ul>
</div>
<!-- /VisualEditor Sandbox -->

View file

@ -1,5 +1,5 @@
$(document).ready( function() {
var wikidoms = {
/* var wikidoms = {
'Wikipedia article': {
'type': 'document',
'children': [
@ -408,7 +408,7 @@ $(document).ready( function() {
]
}
]
},
}, */
/*
'Tables': {
'type': 'document',
@ -492,7 +492,7 @@ $(document).ready( function() {
}
]
},*/
'New document': {
/* 'New document': {
'type': 'document',
'children': [
{
@ -501,7 +501,7 @@ $(document).ready( function() {
}
]
}
};
}; */
/* Sandbox integration hack. Allows both MW integration and demo pages to work */
if ( $('#content').length === 0 ) {
@ -590,36 +590,6 @@ $(document).ready( function() {
documentModel = sandboxEditor.getDocumentModel(),
parent = sandboxEditor.getParent();
/* Sandbox links above the editor */
var $docsList = $( '#es-docs-list' );
$.each( wikidoms, function( title, wikidom ) {
$docsList.append(
$( '<li class="es-docs-listItem"></li>' )
.append(
$( '<a href="#"></a>' )
.text( title )
.click( function() {
var newDocumentModel = new ve.dm.Document( [{ 'type': 'paragraph' }, '', { 'type': '/paragraph' }] );
documentModel.data.splice( 0, documentModel.data.length );
ve.insertIntoArray( documentModel.data, 0, newDocumentModel.data );
surfaceModel.select( new ve.Range( 1, 1 ) );
// FIXME: this should be using ve.batchedSplice(), otherwise things
// could explode if newDocumentModel.getChildren() is very long
documentModel.splice.apply(
documentModel,
[0, documentModel.getChildren().length]
.concat( newDocumentModel.getChildren() )
);
surfaceModel.purgeHistory();
if ( sandboxEditor.currentMode ) {
sandboxEditor.currentMode.update.call( sandboxEditor.currentMode );
}
return false;
} )
)
);
} );
/* Sandbox Warning Message */
$( '#es-docs' ).css( { 'visibility': 'visible' } );
@ -630,5 +600,5 @@ $(document).ready( function() {
$(this).parent().slideUp();
return false;
} );
$( '.es-mode-wikitext' ).click();
//$( '.es-mode-wikitext' ).click();
} );

View file

@ -13,7 +13,6 @@ ve.ui.Context = function( surfaceView, $overlay ) {
// Properties
this.surfaceView = surfaceView;
//this.surfaceView.attachContextView( this );
this.inspectors = {};
this.inspector = null;
this.position = null;