From 53737ae454fb1d01d2f4a152a560cb06730accea Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 20 Feb 2012 23:29:47 +0000 Subject: [PATCH] * 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. --- .../mediawiki.action/mediawiki.action.edit.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 -- 2.20.1