mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-25 08:48:18 +00:00
96052d0d97
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
18 lines
496 B
JavaScript
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()
|
|
);
|
|
} );
|