Extension:CharInsert

CharInsert is an extension that creates JavaScript links that when clicked, insert predefined text into the text box.

These links are usually used in MediaWiki:Edittools system message (for an example, see Wikipedia:MediaWiki:Edittools).

Syntax
Use  tags with a space-separated list of characters or tags for which you wish to allow insertion.

You can use + sign inside a tag to define a place to:
 * insert selected text or
 * place cursor if no text was selected.

You have to enclose templates and spaces inside :

Usage and sample output
→

Note: Clicking the links will have no effect since there is no text box.

Installation

 * Put the following line near the end of your LocalSettings.php file:
 * Add tags into Mediawiki:Edittools or another appropriate system message that gets displayed on edit/create pages (like the copyright warnings), depending e.g. on where the CharInsert tools shall appear on the page.

Styling


To give the charinsert lists additional styling, wrap the contents of your Edittools between  and   and add styling for them to your. This site (www.mediawiki.org) does that to make the links appear like buttons (as shown in the screenshot to the side). The below stylesheet was used for that, copy it to your to apply the same styling.

Scripting
If you have many CharInsert links, one could use Javascript to put them in separate groups and allow dynamic switching with a dropdown menu. For example to separate diacritical characters from wikisyntax etc. Several sites (such as mediawiki.org, de.wikipedia.org and en.wikipedia.org) have done this. They all implemented it in different ways though. Documented below is the way it is done on mediawiki.org:

1. Wrap the all the charinsert tags on MediaWiki:Edittools into a container and give it a descriptive, unique, ID (for example "mw-edittools-charinsert"):  ...
 * 2. Wrap each individual block of charinserts into p tags like this:

 ...
 * Note:
 * Don't change the word 'mw-edittools-section'
 * The text behind "data-section-title=" will identify this group in the dropdown menu.
 * Make sure there is one group without the ' ' directive: That will be the default choice in the dropdown menu. On this site, it is called 'Standard' while the other groups are named by the language for which the characters are significant.
 * 3. Copy the contents of MediaWiki:Gadget-Edittools.js to an equally named page on your own wiki
 * 4. Add the following code to your :