Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -2671,7 +2671,7 @@ |
2672 | 2672 | ) |
2673 | 2673 | ); |
2674 | 2674 | |
2675 | | - $script = ''; |
| 2675 | + $script = 'mw.loader.using("mediawiki.action.edit", function() {'; |
2676 | 2676 | foreach ( $toolarray as $tool ) { |
2677 | 2677 | if ( !$tool ) { |
2678 | 2678 | continue; |
— | — | @@ -2692,6 +2692,14 @@ |
2693 | 2693 | |
2694 | 2694 | $script .= Xml::encodeJsCall( 'mw.toolbar.addButton', $params ); |
2695 | 2695 | } |
| 2696 | + |
| 2697 | + // This used to be called on DOMReady from mediawiki.action.edit, which |
| 2698 | + // ended up causing race conditions with the setup code above. |
| 2699 | + $script .= "\n" . |
| 2700 | + "// Create button bar\n" . |
| 2701 | + "$(function() { mw.toolbar.init(); } );\n"; |
| 2702 | + |
| 2703 | + $script .= '});'; |
2696 | 2704 | $wgOut->addScript( Html::inlineScript( ResourceLoader::makeLoaderConditionalScript( $script ) ) ); |
2697 | 2705 | |
2698 | 2706 | $toolbar = '<div id="toolbar"></div>'; |
Index: trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js |
— | — | @@ -82,9 +82,6 @@ |
83 | 83 | }; |
84 | 84 | scrollEditBox(); |
85 | 85 | |
86 | | - // Create button bar |
87 | | - mw.toolbar.init(); |
88 | | - |
89 | 86 | $( 'textarea, input:text' ).focus( function() { |
90 | 87 | currentFocused = $(this); |
91 | 88 | }); |