From c25e767d6924cd7fbc58ab7b4cb66b8835bd5600 Mon Sep 17 00:00:00 2001 From: Alex Monk Date: Sat, 29 Jun 2013 16:48:09 +0100 Subject: [PATCH] Make mwCustomEditButtons a no-op and mark it as deprecated Bug: 50310 Change-Id: I59d081b4f2581cea25485c69ef2933b94681e82a --- RELEASE-NOTES-1.22 | 2 ++ resources/Resources.php | 1 - .../mediawiki.action/mediawiki.action.edit.js | 16 +++++++--------- skins/common/wikibits.js | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index b88e323dd4..b50666bbe4 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -426,6 +426,8 @@ changes to languages because of Bugzilla reports. * SpecialPrefixindex methods namespacePrefixForm() and showPrefixChunk() have been made protected. They were accepting form variance arguments, this is now using properties in the SpecialPrefixindex class. +* (bug 50310) BREAKING CHANGE: wikibits: Drop support for mwCustomEditButtons. + It defaults to an empty array and emits mw.log.warn when accessed. == Compatibility == diff --git a/resources/Resources.php b/resources/Resources.php index e09f2d7c10..8648b70efa 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -720,7 +720,6 @@ return array( 'scripts' => 'resources/mediawiki.action/mediawiki.action.edit.js', 'dependencies' => array( 'mediawiki.action.edit.styles', - 'mediawiki.legacy.wikibits', 'jquery.textSelection', 'jquery.byteLimit', ), diff --git a/resources/mediawiki.action/mediawiki.action.edit.js b/resources/mediawiki.action/mediawiki.action.edit.js index 38d4bb8d9b..ba711aae0c 100644 --- a/resources/mediawiki.action/mediawiki.action.edit.js +++ b/resources/mediawiki.action/mediawiki.action.edit.js @@ -137,7 +137,7 @@ mw.toolbar = toolbar; $( function () { - var buttons, i, b, $iframe, editBox, scrollTop, $editForm; + var i, b, $iframe, editBox, scrollTop, $editForm; // currentFocus is used to determine where to insert tags $currentFocused = $( '#wpTextbox1' ); @@ -145,22 +145,20 @@ // Populate the selector cache for $toolbar $toolbar = $( '#toolbar' ); - // Legacy: Merge buttons from mwCustomEditButtons - buttons = [].concat( queue, window.mwCustomEditButtons ); - // Clear queue - queue.length = 0; - - for ( i = 0; i < buttons.length; i++ ) { - b = buttons[i]; + for ( i = 0; i < queue.length; i++ ) { + b = queue[i]; if ( $.isArray( b ) ) { // Forwarded arguments array from mw.toolbar.addButton insertButton.apply( toolbar, b ); } else { - // Raw object from mw.toolbar.addButtons or mwCustomEditButtons + // Raw object from mw.toolbar.addButtons insertButton( b ); } } + // Clear queue + queue.length = 0; + // This causes further calls to addButton to go to insertion directly // instead of to the queue. // It is important that this is after the one and only loop through diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 488c37dad2..7dc4a95752 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -137,7 +137,7 @@ window.killEvt = function( evt ) { }; window.mwEditButtons = []; -window.mwCustomEditButtons = []; // eg to add in MediaWiki:Common.js +mw.log.deprecate( window, 'mwCustomEditButtons', [], 'Use mw.toolbar.addButton instead.' ); window.escapeQuotes = function( text ) { var re = new RegExp( "'", "g" ); -- 2.20.1