Extension:TinyMCE

TinyMCE is a MediaWiki extension that lets users edit wiki pages using the popular open source JavaScript-based WYSIWYG editor TinyMCE. It is based on the BlueSpice VisualEditor extension (not to be confused with the standard VisualEditor extension), developed as part of the BlueSpice package by [http://hallowelt.com Hallo Welt! GmbH]. It was then modified significantly by Duncan Crane and Yaron Koren to work better as a standalone extension, and to work within forms defined by the Page Forms extension.

TinyMCE will never work as well as the standard VisualEditor extension - among other things, its handling of template calls is quite primitive compared to VisualEditor's. However, it does have several advantages:
 * It is easier to install, since it does not require any outside libraries or services, like the Parsoid service required for VisualEditor.
 * There are a wide variety of outside plugins that have been developed for the TinyMCE editor, like spellcheckers; these may provide helpful functionality that VisualEditor does not provide.
 * It works within Page Forms, unlike VisualEditor; though VE support for Page Forms may be coming by mid-2018.

Download
The code for the TinyMCE extension can currently be found here. To download it, you can download the zip file, or call the following within your /extensions directory:

git clone https://github.com/yaronkoren/TinyMCE.git

It is planned for the code for this extension to move into the Wikimedia Git/Gerrit repository in the near future.

Installation
If you are using MediaWiki 1.27 or higher, add the following line to your LocalSettings.php file:

For earlier versions, you should cal the following instead:

To get TinyMCE working within textarea inputs in forms defined by Page Forms, you must use a version of Page Forms from March 6, 2018 or later, then add "|editor=tinymce" to the field tag for any textarea input that you want to have editable with TinyMCE.

Macros
You can have TinyMCE display custom "macros": one or more options that insert a custom bit of wikitext into the page. These will show up as options under the "+" menu item in the TinyMCE display. They produce text that can either be inserted by itself, or "wraps" around whatever piece of text is already highlighted in the editor.

To add a macro, you need to add a few lines to LocalSettings.php. Here is one example:

Let's go through these values:
 * is the text that appears for that macro in the dropdown menu.
 * is the icon image that appears alongside the text; it is optional. It can be either a full URL (like above), or just an image name; if it is an image name, the code will look in the wiki for an uploaded file with that name.
 * is the actual text that gets inserted into the page. It has a mini-syntax, involving "!" - if two exclamation marks are found within the text, then the parts outside the exclamation marks will get wrapped around whatever text is highlighted on the page. If no text is highlighted, then the whole 'text' value will get inserted, without the exclamation marks. For example, if the macro above is used, and it is pressed while the text " " is highlighted, then the resulting text on the page will be " ". If, on the other hand, no text is highlighted, then the resulting text on the page will be " ".

Using with WikiEditor
You can use the TinyMCE extension in conjunction with the WikiEditor extension - by having WikiEditor displayed on pages where TinyMCE is disabled, if both extensions are installed. To do this, you just need to add this small patch to the WikiEditor code; it is a pending change that will hopefully get merged into the main WikiEditor code in the future.

Usage
The TinyMCE extension adds another tab to any TinyMCE-editable page, which points to "action=tinymceedit". It gives this tab the name "Edit", and renames the standard "Edit" tab to "Edit source" (in whatever language the wiki is in), in the same way that the VisualEditor extension does it.

By default, all namespaces other than "Template:" and Page Forms' "Form:" namespace are editable with TinyMCE.

Any user can get rid of TinyMCE tabs when they view pages by going to "Preferences", then clicking the "Editing" tab and unselecting the checkbox labeled "Use the TinyMCE editor to edit pages".