From: Tim Starling Date: Mon, 20 Feb 2012 23:29:47 +0000 (+0000) Subject: * Fixed failure of the edit toolbar to load when $wgResourceLoaderExperimentalAsyncLo... X-Git-Tag: 1.31.0-rc.0~24598 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=53737ae454fb1d01d2f4a152a560cb06730accea;p=lhc%2Fweb%2Fwiklou.git * 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. --- diff --git a/resources/mediawiki.action/mediawiki.action.edit.js b/resources/mediawiki.action/mediawiki.action.edit.js index 06fe100694..499aba6f03 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.js +++ b/resources/mediawiki.action/mediawiki.action.edit.js @@ -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(); + + // 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