Extension:VEForAll

From MediaWiki.org
Jump to navigation Jump to search


MediaWiki extensions manual
OOjs UI icon advanced.svg
VEForAll
Release status: beta
Description Defines JavaScript functionality to allow other extensions to incorporate VisualEditor into their form textareas
Author(s) Pierre Boutet, Clément Flipo, Ike Hecht, Yaron Koren and Cindy Cicalese
Latest version 0.2 (February 2020)
Compatibility policy master
MediaWiki 1.25+
Database changes No
License GNU General Public License 2.0 or later
Download
Translate the VEForAll extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

The VEForAll ("VisualEditor For All") extension allows other extensions to incorporate the VisualEditor interface into textareas for user editing.

This extension does not directly impact the user interface. Rather, it defines a JavaScript function (called "applyVisualEditor()") that can be called by other extensions on their textareas. At the moment, two extensions - CommentStreams and Page Forms - can make use of VEForAll.

As might be expected, the VisualEditor extension must be installed for this extension to work.

Download[edit]

You can download the External Data code, in .zip format, here.

You can also download the code directly via Git from the MediaWiki source code repository. From a command line, you can call the following:

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VEForAll

You can also view the code online here.

Installation[edit]

To install this extension, create a 'VEForAll' directory (either by extracting a compressed file or downloading via Git), and place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php', add the following line:

wfLoadExtension( 'VEForAll' );

Using VEForAll with other extensions[edit]

VEForAll can currently be used with the CommentStreams and Page Forms extensions:

  • For CommentStreams, you must use version 4.5 of the extension or higher. You simply need to have VEForAll (and VisualEditor) installed, and then textareas for entering comments will automatically get the VisualEditor interface.
  • For Page Forms, you must use version 4.7 or higher. Then, in the form definition, add |editor=visualeditor to the tag for any textarea input (including the "free text" input), and the VisualEditor interface should show up when viewing that form.

Configuration[edit]

By default, the toolbar is display at the bottom of the textarea. In Page Forms, you can instead display it at the top by adding |class=toolbarOnTop to the textarea's tag in the form definition.

You can use the "VEForAllToolbarConfigNormal" hook to customize the display of the VisualEditor toolbar. For example, to add "math" and "media" buttons, add the following to LocalSettings.php:

$wgHooks['VEForAllToolbarConfigNormal'][] = function( &$defaultConfigNormal ) {
        $defaultConfigNormal[4]['include'][] = 'math';
        $defaultConfigNormal[4]['include'][] = 'media';
};

Authors and credits[edit]

VEForAll is heavily based on the (now-obsolete) VEForPageForm extension by Pierre Boutet and Clément Flipo. Some work to make the code more generic was done by Ike Hecht, Yaron Koren and Cindy Cicalese. VEForAll also includes code from the StructuredDiscussions extension.