Extension:VisualEditor

The VisualEditor project aims to create a reliable rich-text editor for the Web and for MediaWiki. More information can be found on the project page; this page is just about the VisualEditor-MediaWiki extension itself. The extension relies on the separate nodeJS-based Parsoid parser service to be up and running in order to edit pages.

User guide
See Help:VisualEditor/User guide.

Download
For the General User: If you're using the latest stable version of MediaWiki you will need to download the VisualEditor-MediaWiki extension from the ExtensionDistributor page.

For the Advanced User:

The following download instructions are for use with the latest nightly build of MediaWiki only. cd extensions git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git cd VisualEditor git submodule update --init

If you cannot use git (e.g. you are in an air-gapped installation), you can download a snapshot of VisualEditor-MediaWiki for master or for a release version of MediaWiki from the ExtensionDistributor page. After you've got the code, save it into the extensions/VisualEditor directory of your wiki.
 * VisualEditor-MediaWiki's master branch contains the latest code, as used at Wikimedia. This code is potentially slightly buggy or unstable, but is likely to have fewer bugs and more features than old builds.
 * The master branch requires alpha builds of MediaWiki (currently, 1.28-wmf.8 ) and will not work with the older, official releases of MediaWiki like 1.26.2; for that, use the REL1_26 branch (command: ).
 * The  command is vital, as MediaWiki-VisualEditor needs the core VisualEditor submodule to work. If you do not use this command, VisualEditor will fail to work.

Set up a Parsoid service
If you want to be able to edit existing pages and save pages with VisualEditor you need a Parsoid service that converts between wikitext and the HTML that VisualEditor displays for editing.

To set up your own Parsoid service follow the Parsoid installation instructions before setting up VisualEditor. Note that it can be particularly complicated to set up Parsoid and Node.js in non-standard systems, like those running Windows or Debian.

Basic configuration for MediaWiki-VisualEditor
By default, MediaWiki-VisualEditor does not enable itself for users. To make it available, add the following lines to your wiki's  after you have downloaded the extension:

"Note that you can do this before you have installed the Parsoid node.js service to experiment with VE; this will mean that you can try the editor out in 'create' mode on your own wiki, but you will not be able to save or edit existing pages."Other extensions which load plugins for VE (e.g. Math) can be loaded before or after VE if you are using MediaWiki 1.25 or later; the plugins should work either way.

Linking with Parsoid
To get VisualEditor to talk to Parsoid, add the following code to your  to specify your Parsoid instance:

A single Parsoid server can handle multiple wikis. The Parsoid  setting identifies your wiki configuration to Parsoid. By default it is set to the hostname named by, but you can pick an arbitrary string. Older versions of Parsoid also used a unique "prefix" to identify the server; you may need to list that here as well.

Parsoid must have been configured to match, using a line in Parsoid's localsettings.js like: Again, the "domain" property is optional in the Parsoid configuration; it defaults to the hostname used in the  property if not specified. The "prefix" property can also be omitted unless you are running an older version of Parsoid.

See Parsoid/Setup for more details.

Servers with multiple virtual sites
If Apache2 is configured with multiple virtual sites, Parsoid is (in standard configuration) only able to access the default site. To check for this problem, run  on the server.

If the response starts with: then you don't have the problem, but if it doesn't, you may need to configure a host alias that Parsoid can use:

Look at the apache2 configuration file for the virtual server hosting the wiki, near the top of the file there should be la line like: "" If the '*' is present, then the alias can be to localhost, if there is an IP address replacing the '*' then the alias must be to that IP address. In the same file add a line: ""

In the hosts file of the server, add a route for my_wiki_alias, either for 127.0.0.1 (if the apache2 virtual server configuration had the '*' above, else to the IP address from the apache2 virtual server configuration.

Finally, in the Parsoid  file, find the   setting, and set it to:

Reload the network config, apache config and Parsoid config, and retest the curl command above.

The same method works for multiple wikis hosted on multiple virtual servers on a host (use a different alias and add a  setting for each wiki).

Forwarding Cookies to Parsoid
''ONLY enable this on private wikis and ONLY IF you understand the SECURITY IMPLICATIONS of sending Cookie headers to Parsoid over HTTP! (but see the HTTPS section below)''

An alternative to the approach above is explicitely giving read permissions to requests from the parsoid server as mentioned in: explicitly remove restrictions for Parsoid by IP address.

Parsoid over HTTPS
By default, Parsoid only supports HTTP connections. However, it's easy to provide HTTPS Parsoid by using Stunnel, a utility which offers SSL wrapping for arbitrary sockets. Most Unix distributions have 'stunnel' or 'stunnel4' package available from the repository. The following config file shard (e.g. /etc/stunnel/parsoid.conf) should do the trick:

Once this is working, you can use the appropriate URL (e.g. 'https://parsoid.mydomain.com:8143') in your MediaWiki configuration for VisualEditor.

Setting up such a configuration allows you to avoid the security implications of transmitting parsoid cookies in cleartext.

Producing and installing SSL certificates is beyond the scope of this document.

Parsoid Authentication Without Forwarding Cookies
The forwarding of cookies (and the enabling of  and the   property) can be avoided by adding a user (which may be called  ) to the wiki and then add the NetworkAuth Extension to the wiki with the configuration in  :

Where the IP address matches that of the Parsoid server and the user matches the one you added to the wiki. This should of course only be done if the Parsoid server is on a 'trusted' network.

See also: Note for MediaWiki 1.23 users: For MediaWiki 1.23, as well as the Parsoid nodejs service, you will also need to install the Parsoid PHP extension. Without this, VisualEditor will fail to load (as it supplied key styling code until that was moved in MediaWiki itself in MediaWiki 1.24 onwards).
 * Alternative solution using a modification to LocalSettings.php and the $_SERVER['REMOTE_ADDR'] variable, which grants read access to connections that originate from the local server.

Note for Parsoid on Windows and other systems: It is particularly complicated and time consuming to set up VisualEditor with Parsoid in non-standard systems, like those running Windows or non-standard Linux - those difficulties might even prevent the successful installation of VisualEditor for some people on some platforms.

Complete list of configuration options
Each configuration option is shown without the  prefix for brevity.

Old configuration parameters
As above, each configuration option is shown without the  prefix for brevity.

Setting VisualEditor up on shared hosting
See VisualEditor/Installation on a shared host

Troubleshooting

 * Error loading data from server : HTTP 500. Would you like to retry?
 * "curl", "php5-curl", or "php7.0-curl" is not installed or not accessible to your server.
 * Or you setMwApi uri is set incorrectly with e.g. https instead of http. Or there is a rewrite rule in your apache configuration.


 * parsoidserver-http-curl-error : couldn't connect to host.
 * Parsoid is not running, or  is not set correctly


 * parsoidserver-http-curl-error : Failed to connect to .... : Permission denied.
 * Can be caused by a cURL request on a Security-Enhanced Linux (SELinux, like CentOS) to a non standard port like 8000 in the example configuration above, see http://www.akashif.co.uk/php/curl-error-7-failed-to-connect-to-permission-denied and https://www.centos.org/forums/viewtopic.php?f=47&t=53223&p=225372#p225372


 * parsoidserver-http-bad-status : 401
 * Caused by read or edit restrictions. If you've set up a private wiki and don't want to use cookie forwarding, you can explicitly remove restrictions for Parsoid by IP address.


 * parsoidserver-http-not-found : 404 (or timeout)
 * Caused by wrong path to MediaWiki API endpoint. Set correct url to the right path to  in Parsoid's   config file. If you have set up following the recommendations, your API path would be "http://localhost/w/api.php". Add this API path to "localsettings.js" like "parsoidConfig.setInterwiki( 'localhost', 'http://localhost/w/api.php ' );".


 * No visible error (Appears to load forever)
 * Check the parsoid log file, and consult Parsoid/Troubleshooting.