Extension:WikiEditor/Toolbar customization

If you're just here to get some quick code that you can copypaste into your user JS and will just work out of the box, see the customizations library. The rest of this article explains the technical details of customizing the toolbar and requires a basic level of understanding of JavaScript.

Configuration structure
The toolbar widget is defined by a configuration object. There is no complete documentation yet (this'll be written shortly), but you can look at the configuration object for the default toolbar in SVN.

You can modify the toolbar even after it's been built by calling the  function on the textarea. You will need to do this inside an  call, though.

Removing things
TODO

Modifying things
Warning: the following examples have multiple issues that are yet to be fixed: Working example could be found at the bottom of ru:MediaWiki:ToolbarNew.js
 * The binding doesn't seem to work with  but does work if called with addOnloadHook
 * Binding should be done with
 * Assigned icon is simply ignored as long as the object has  values

We don't really have a nice API to modify things, unfortunately. The best we have is a hook to change the configuration of a section just before it's being built: