Extension:VisualEditor

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
VisualEditor

Release status: experimental

VisualEditor-logo.svg
Implementation Page action, Extended syntax, Skin
Description Provides the VisualEditor to MediaWiki
MediaWiki 1.21/wmf5+
Database changes No
License MIT
Download
README
Parameters
  • $wgVisualEditorNamespaces
  • $wgVisualEditorParsoidURL
  • $wgVisualEditorParsoidPrefix
Hooks used
BeforePageDisplay

GetPreferences
ListDefinedTags
MakeGlobalVariablesScript
ResourceLoaderTestModules

Check usage and version matrix
Bugs: list open list all report

The VisualEditor project aims to create a reliable rich-text editor for MediaWiki. More information can be found here.

The extension relies on the separate Parsoid NodeJS-based parser service to be up and running in order to edit pages. Stable release is planned for late 2013.

Use & hack this at your own risk, it's not generally ready for real-world applications yet! Patches welcome.

Contents

Download [edit]

You can download the extension directly from the MediaWiki source code repository (browse code). You can get:

One of the extensions tags

Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag

  • Go to the tags list
  • Click the name of the tag you want to download
  • Click "snapshot"
The latest version of one of the extensions branches

Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.

  • Go to the branches list
  • Click the branch name
  • Click "snapshot"
A snapshot made during the release of a MediaWiki version.

This might be unstable and is not guaranteed to work with the associated MediaWiki version.

After you've got the code, save it into the extensions/VisualEditor directory of your wiki.

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git

Basic setup instructions [edit]

To experiment with this extension locally:

require_once("$IP/extensions/VisualEditor/VisualEditor.php");
 
// Create VisualEditor namespace
define( 'NS_VISUALEDITOR', 2500 );
define( 'NS_VISUALEDITOR_TALK', 2501 );
$wgExtraNamespaces[NS_VISUALEDITOR] = 'VisualEditor';
$wgExtraNamespaces[NS_VISUALEDITOR_TALK] = 'VisualEditor_talk';
 
// Allow using VisualEditor in the main namespace only (default)
$wgVisualEditorNamespaces = array( NS_MAIN );
 
// Restrict VisualEditor to the VisualEditor namespace
$wgVisualEditorNamespaces = array();
$wgVisualEditorNamespaces[] = NS_VISUALEDITOR;
 
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
 
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';

Congratulations, you should now have VisualEditor up and running! Test it by visiting a page like VisualEditor:Sandbox on your wiki and editing it.

Linking with Parsoid [edit]

The above will only let you fiddle with pages, and not save them or edit existing ones, as you don't yet have the Parsoid service installed yet. Follow the Parsoid installation instructions and start your Parsoid service. To get VisualEditor to talk to the parser, add a line like the following to your LocalSettings.php to specify your Parsoid instance:

$wgVisualEditorParsoidURL = 'http://localhost:8000/';

Additionally, if you want to use a Parsoid instance with a wiki that isn't running on localhost, you will need to edit the following line (the default is fine for most people's configurations):

$wgVisualEditorParsoidPrefix = 'localhost';