Extension talk:WikiEditor/Toolbar customization

Problem with adding a new section
Hi, Adding buttons work fine, but adding a sections does not work that well. If you add a section, open it and reload the page the textarea will not be fully visible. Is there some easy way to refresh it's height?

Code used:

Is this a bug? Or maybe I'm doing something wrong. --Nux 02:48, 21 April 2010 (UTC)

Switching from Monobook
If you're just switching from Monobook and looking for a way to keep your mwCustomEditButtonse without too much hassle, see insertVectorButtons.js. This small script almost does it for you by translating the old way to the new way. Ofcourse if you're up for an adventure and/or want to use the more advanced feautures of the new toolbar you'll have to learn the native syntax (see examples here). If you have any questions about it, please let me know on my meta talkpage or the scripts talkpage. --Krinkle / Krinkle 23:13, 14 June 2010 (UTC)

Moving a button

 * 1) How can I move a button from the "advanced" menu to main menu?
 * 2) How can I cancel an empty menu?
 * 3) How can I create a custom menu based on the "special characters" menu? i.e. I'd like to add a new menu named "Codes & templates" where it'll have a submenu: Titles, Templates, Maintenance. Each submene will have a list of codes/templated. for example, Titles will have "==References==\n
 * tab - adds a tab character
 * &amp;nbsp;
 * &amp;rlm; (especially useful for RTL projects, although somewhat problematic in itself)

(I actually disagree with some of the additions, but that's not the point of this message.)

The icons that were used for these added buttons were either taken from Monobook or drawn ad hoc.


 * Is there a repository of icons for extra buttons?
 * If we create some new and better Vector-style icons by ourselves, where should we share them, so all language projects will be able to reuse them easily?
 * Is there a style guide for drawing Vector icons? --Amir E. Aharoni 08:44, 15 July 2010 (UTC)


 * I'd upload them to commons. Many old style buttons are already there, although a new category "Buttons for Vector skin" or so may be desirable. If you create new buttons, you should dual license them GPL to make sure there's no problem in potentially shipping them with mediawiki in the future. Platonides 00:04, 20 July 2010 (UTC)
 * I had asked the he.wiki graphics guys to create new icons, and they did w:he:%D7%95%D7%A7:%D7%A1%D7%93, but as it turns out, it needs to be done with transparent background, as there are diff background colors in the toolbar.
 * Re gallery, there already is a page for toolbar icons in commons: MediaWiki_edit_toolbar. Obviously more can be created and added to the page. 213.8.121.230 11:11, 20 July 2010 (UTC)

Please update
Please put more information on here. We were promised more information would be available but doesn't look updated at all. If not here, where else are we to turn to for help? :(

Adding buttons to WikiEditor in Useability Extension in MediaWiki 1.16.2
The information provided here appears to work for adding new sections and buttons to the WikiEditor within the Usability Initiative

However, for MediaWiki 1.16.2 WikiEditor as part of the Usability Extension, in order to add a button to the advanced section groups, you have to use list as the group name instead of format for the group name.

The Existing sections - advanced section groups shows --Ken Roy 14:20, 16 March 2011 (UTC)
 * The advanced section, with the groups heading, format, size, insert and search.

How to add a Booklet
If you use the Example and get the error Uncaught exception: ReferenceError: Undefined variable: page, then try this: The trick is to add an unempty booklet. 78.53.80.53

Adding a button on main toolbar MW1.17x
i'm still not clear on how to add a button on main tool bar. can someone give me some guidance? --12.46.139.200 23:46, 13 July 2011 (UTC)

I've found out that it doesn't work at all in MW1.17.

But I got it working flawlessly using the examples of the main page on MW1.18a

Luis Orlando, 28 October 2011

Example of moving the Help section?
I'd like to add a section to the toolbar in between "Special characters" and "Help", so the Help setion remains the last, rightmost section. Could you please show an example of how to do this? Thank you. Maiden taiwan 16:59, 15 August 2011 (UTC)

Removing special characters section
After much pain and trial-and-error, I still haven't been able to remove the special characters section.

Can anyone kindly provide a few lines of suggestions on how to do it? Dc321 06:02, 5 September 2011 (UTC)
 * Something like this:

$('#wpTextbox1').wikiEditor('removeFromToolbar', { 'section': 'characters' }); Maiden taiwan 15:11, 23 September 2011 (UTC)

I only succeeded adding, removing and modifying the editor toolbar after I upgraded to mediawiki 1.18a

Here is what I used to remove the special characters section: $( function {            if ( typeof $.fn.wikiEditor != 'undefined' ) {                   $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { 'section': 'characters', });            }        }); Luis Orlando - 28 October 2011


 * I have done extensive modifications to the toolbar in 1.17.0: adding buttons, removing buttons, adding dropdowns, creating dialogs. In a few cases, I could not get a button icon to display for unknown reasons. Perhaps that was a bug that got fixed in 1.18? Maiden taiwan 15:15, 28 October 2011 (UTC)

How do I remove not the whole characters section, but only one of the character sets (pages) within? Can this only be fixed in jquery.wikiEditor.toolbar.config.js or also in MediaWiki:Common.js?
 * Ribe (talk) 10:30, 4 June 2012 (UTC)

Creating Example "periMsg" part
my new button is showing up, but i have issue with the "periMsg" part.

Where is it getting that from? for example, (below) code shoots     < File Link Here > 

if ( typeof $j != 'undefined' && typeof $j.fn.wikiEditor != 'undefined' ) { $j( function {               $j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'section': 'main', 'group': 'insert', 'tools': { 'comment': { 'label': 'FileLink', 'type': 'button', 'icon': 'http://someweb.com/insert-filelink.png', 'action': { 'type': 'encapsulate', 'options': { 'pre': " ", 'periMsg': 'File Link Here', 'post': " ", 'ownline': true }                                       }                                }                        }                } );        } ); }


 * applies only if you're using a system message for your text (in your case, ). If you are supplying literal text, as is the case here, use   instead.
 * When a system message is undefined, it appears as . That's what you're seeing. Maiden taiwan 19:46, 2 November 2011 (UTC)

... 'pre': " ", 'periMsg': 'wikieditor-toolbar-tool-filelink-example', 'post': " ",
 * THANKS a MUNCH for clarifying.  I got it working with peri  (no periMsg), but i can't seem to get the periMsg to work even if have message for it.

MediaWiki:Wikieditor-toolbar-tool-filelink-example has 'testing filelink example' written in it. returns 

any idea?


 * Yes. Every system message used by the toolbar needs to be registered with ResourceLoader. See the example here, where it says . You need an entry in the messages array for every system message used by the toolbar -- putting them in your .i18n.php file is not sufficient. Good luck. Maiden taiwan 00:48, 3 November 2011 (UTC)

Thanks!! i was able to mod the WikiEditor.php and add in the line for it BTW: -holy cow! i have your book. i want an autograph!

Configuration structure
Can someone explain this sentences more clearly please? Where, when, how? give an example in an extension... please. is not understandable for beginners: where to put the below examples please. Sorry to have put this asking here, but these precisions are really needed

Post by Lamidesbetes. Moved from manual page. --&#91;&#91;kgh&#93;&#93; 18:51, 31 January 2012 (UTC)

Edit an existing button
How do you edit an already existing button? This rather simple task is not working for me. I've modified the following section in ext.wikiEditor.toolbar.js but the changes don't have any effect: The modified parts are the wiki syntax in the pre and post attribute. I'd like to add the parser function {{#!: to this button. Obviously I'm missing something here as not even random changes are displayed when using the modified button. The changes are not applied at all. Any help is much appreciated. {{unsigned2|09:51, 19 March 2012‎|79.202.220.151}}

Completely useless page for the current MediaWiki
Nothing described here works in the current MediaWiki. Most important  does never exists nor works no matter where or when I call it. I tried to put it into an  event as described here and   is defined when I do so but my button never shows up. Could somebody please, please either fix this page or fix the broken MediaWiki? Same problem with the old toolbar. I'm still able to add a button but can not assign a function to it any more, no matter if I use  or what. Yes, I'm complaining. --TMg (talk) 08:51, 30 March 2012 (UTC)
 * Have you tried the code suggested on Extension:WikiEditor/Toolbar customization/Library? It works for me. Helder 23:17, 31 March 2012 (UTC)
 * I went ahead and did an [//www.mediawiki.org/w/index.php?title=Extension:WikiEditor/Toolbar_customization&diff=prev&oldid=518288 update] to the main page as well. Feel free to make more improvements (or to fix eventual mistakes). Helder 01:24, 1 April 2012 (UTC)

No custom buttons in MW 1.18.2
We got a problem. We have a Wiki running on 1.17.2 with custom buttons in the WikiEditor, no problems there they work just fine. Yesterday I build a Wiki with MW 1.18.2 and used the same code in  but the buttons will not show up. I also tried to put the code in  but it makes no difference. Disabled all installed extensions except WikiEditor but still no luck. I noticed the documentation changed but I am a little lost because it just makes no sense. What are we doing wrong here? Any ideas? Thanks.


 * MediaWiki 1.18.2
 * PHP      5.3.8 (apache2handler)
 * MySQL    5.5.19

Code we use in, works fine in MW 1.17.2: /* custom code for WikiEditor - start */ function customizeToolbar { // adds button to toolbar $('#wpTextbox1').wikiEditor('addToToolbar', {			'section': 'advanced',			'group': 'format',			'tools': {					'strikethrough': {							label: 'onlyinclude',							type: 'button',							icon: '//xxxxxxx/img_auth.php/f/f9/xxxxxxxx.png',							action: {									type: 'encapsulate',									options: {											pre: " ",											post: " "									}							}					}			}	}); } /* Check if we are in edit mode and the required modules are available and then customize the toolbar */ if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) != -1 ) { mw.loader.using( 'user.options', function {                if ( mw.user.options.get('usebetatoolbar') ) {                        mw.loader.using( 'ext.wikiEditor.toolbar', function  { $(customizeToolbar); } );               }        } ); } /* custom code for WikiEditor - end */ --Jongfeli (talk) 20:54, 23 April 2012 (UTC)

Found a sollution.

Added at the start: // Check that the toolbar is available if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) { // Execute on load $( function {

// Extra buttons code.....

}); }

Deleted at the end /* Check if we are in edit mode and the required modules are available and then customize the toolbar */ if ($.inArray(mw.config.get('wgAction'), ['edit', 'submit']) != -1 ) { mw.loader.using( 'user.options', function {                if ( mw.user.options.get('usebetatoolbar') ) {                        mw.loader.using( 'ext.wikiEditor.toolbar', function  { $(customizeToolbar); } );               }        } ); }

This works both in 1.17.2 and 1.18.2 The documentation has changed recently. Things are getting a little confusing here. In Extension:WikiEditor/Toolbar_customization from March 30 the part added in our code is still documented but in the latest revision it is gone. Do you need it when using  an MW 1.18.2? Regards, --Jongfeli (talk) 06:59, 24 April 2012 (UTC)

Adding characters
Hi, I'm trying to add some special characters to the symbols page. The code below works fine if I execute it from Firebug, but when I add it to my common.js, I get the error

so I guess it loads too early? Are there some more dependencies I should add? Danmichaelo (talk) 15:48, 28 April 2012 (UTC)
 * When I execute your code on Google Chrome's console, on edit mode, I get

TypeError: Cannot set property 'ʾ' of undefined
 * if the "Special Characters" section is hidden. On the other hand, it works fine if I execute it after clicking on the "Special Characters" header. So, it seems to be necessary to check if special characters section is available. I just don't know how exactly to do that.
 * I don't thing it is necessary to put 'jquery.wikiEditor.toolbar.config' in the "mw.loader.using", because the module "ext.wikiEditor.toolbar" already has that as a dependency (so it should be loaded by Resource Loader). Helder 18:43, 28 April 2012 (UTC)


 * Thanks, I had "Special characters" open all the time, so I didn't notice :) First I found the loadSection event, which appeared to work, but it doesn't bubble to #wpTextbox1, and I didn't find any information about it, so I was a little sceptical to rely on it, and ended up with the following code instead, which works;


 * Danmichaelo (talk) 15:04, 2 May 2012 (UTC)