I'm running on FreeBSD 10.3, php 7.1 and Mediawiki 1.29.
I studied the Extension:WikiEditor/Toolbar customization/Library and wrote a widget to add an icon to the toolbar. It allows you to highlight some text with your mouse, then click on the icon to enclose the text in the following code: <span background-color: yellow>Your text here</span>. Then all the editor has to do is change the color.
The problem is, the icon sometimes doesn't show up, and you have to reload the edit page repeatedly to get it to appear. What would cause this apparently random behavior? I'm not seeing any errors in console. But I am seeing these notices:
[Warning] This page is using the deprecated ResourceLoader module "jquery.ui.widget".
[Warning] This page is using the deprecated ResourceLoader module "jquery.ui.position".
[Warning] This page is using the deprecated ResourceLoader module "jquery.ui.core".
Please use "mediawiki.ui.button" or "oojs-ui" instead.
[Warning] Use of "wgServer" is deprecated. Use mw.config instead. (load.php, line 153)
[Warning] Use of "wgArticlePath" is deprecated. Use mw.config instead. (load.php, line 153)
[Warning] Use of "wgScriptPath" is deprecated. Use mw.config instead. (load.php, line 153)
[Warning] Use of "wgCurRevisionId" is deprecated. Use mw.config instead. (load.php, line 153)
[Warning] Use of "wgPageName" is deprecated. Use mw.config instead. (load.php, line 153)
Here's the code, basically stolen from that page and modified:
var customizeToolbar = function() {
/* Your code goes here */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"highlight": {
label: 'Highlight',
type: 'button',
icon: 'images/highlight.png',
action: {
type: 'encapsulate',
options: {
pre: "<span style=\"background-color: yellow\">",
post: "</span>"
}
}
}
}
});
};
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar … */
if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) !== -1) {
mw.loader.using('user.options').then(function() {
// This can be the string "0" if the user disabled the preference
if (mw.user.options.get('usebetatoolbar') == 1) {
$.when(
mw.loader.using('ext.wikiEditor.toolbar'), $.ready
).then(customizeToolbar);
}
});
}