mediawiki-extensions-WikiEd.../modules/ext.wikiEditor.toolbar.js
Trevor Parscal 96052d0d97 (bug 34885) Fixes issue where old toolbar was killed, even when the new toolbar was incompatible
Instead of wiping the old toolbar out on the server side we now just wrap the old toolbar in a div that has an inline style that prevents it from being displayed. This is only done when the toolbar is enabled. When the toolbar code runs on the client, if the toolbar ends up being incompatible, the old toolbar's wrapping div is shown. This avoids the side-effect of the old toolbar showing up momentarily while the new toolbar loads. It's a dirty hack, but we explored this extensively and it's the least evil way we could come up with that worked consistently.

Change-Id: I6fefadea4dbd01b96a0b95c50bc9ef526144dc3c
2012-04-17 15:19:20 -07:00

18 lines
496 B
JavaScript

/*
* JavaScript for WikiEditor Toolbar
*/
$( document ).ready( function() {
if ( !$.wikiEditor.isSupported( $.wikiEditor.modules.toolbar ) ) {
$( '.wikiEditor-oldToolbar' ).show();
return;
}
// The old toolbar is still in place and needs to be removed so there aren't two toolbars
$( '#toolbar' ).remove();
// Add toolbar module
// TODO: Implement .wikiEditor( 'remove' )
$( '#wpTextbox1' ).wikiEditor(
'addModule', $.wikiEditor.modules.toolbar.config.getDefaultConfig()
);
} );