https://www.mediawiki.org/wiki/Special:Code/MediaWiki/111983

Revision: 111983
Author:   tstarling
Date:     2012-02-20 23:29:47 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
* Fixed failure of the edit toolbar to load when 
$wgResourceLoaderExperimentalAsyncLoading is enabled and module execution 
occurs before the edit box appears in the DOM. Similar to bug 34538.
* Also fixed breakage of byteLimit on edit in the same scenario.
* For 1.19 backport so no release notes.

Modified Paths:
--------------
    trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js

Modified: trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js
===================================================================
--- trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js    
2012-02-20 23:24:04 UTC (rev 111982)
+++ trunk/phase3/resources/mediawiki.action/mediawiki.action.edit.js    
2012-02-20 23:29:47 UTC (rev 111983)
@@ -3,7 +3,7 @@
        var currentFocused = $( '#wpTextbox1' );
 
        mw.toolbar = {
-               $toolbar : $( '#toolbar' ),
+               $toolbar : [],
                buttons : [],
                // If you want to add buttons, use
                // mw.toolbar.addButton( imageFile, speedTip, tagOpen, 
tagClose, sampleText, imageId, selectText );
@@ -37,7 +37,12 @@
                                );
                        }
                },
-               init : function() {
+
+               // For backwards compatibility
+               init : function() {},
+
+               onReady : function() {
+                       mw.toolbar.$toolbar = $( '#toolbar' );
                        // Legacy
                        // Merge buttons from mwCustomEditButtons
                        var buttons = [].concat( this.buttons, 
window.mwCustomEditButtons );
@@ -59,10 +64,12 @@
        window.addButton =  mw.toolbar.addButton;
        window.insertTags = mw.toolbar.insertTags;
 
-       //make sure edit summary does not exceed byte limit
-       $( '#wpSummary' ).byteLimit( 250 );
+       $( document ).ready( function() {
+               mw.toolbar.onReady();
 
-       $( document ).ready( function() {
+               // Make sure edit summary does not exceed byte limit
+               $( '#wpSummary' ).byteLimit( 250 );
+
                /**
                 * Restore the edit box scroll state following a preview 
operation,
                 * and set up a form submission handler to remember this state


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to