Visual Editor

From Biowikifarm Metawiki
Jump to: navigation, search

This article describes how to enable the Visual Editor on any of the wikis at the Biowikifarm. To see how the Visual Editor extension as well as the required nodejs and parsoid were installed, see the article Parsoid installation

The Visual Editor is an extension that allows users to edit wiki pages using a graphical interface (a WYSIWYG Editor) instead of the regular text edit that requires writing the wiki syntax manually.

Enabling the Visual Editor

To enable the VisualEditor in a wiki on the Biowikifarm, add the following line to the LocalSettings.php of that wiki


Note: sometimes the path has to be adjusted if the directory structure of the wiki is different from the default. It needs to be the same relative path as for inclusion of MediaWikiCommonSettings_REL1_26.php

By default the VisualEditor not enabled even if installed, the users have to enable it in the settings themselves in their preferences under Preferences -> Editing -> Editor -> "Enable the visual editor. [...]".

The option to enable the Visual Editor for an individual user in the user preferences.

To enable the VisualEditor by default for all users that have editing rights, add the following line to the LocalSettings.php:

$wgDefaultUserOptions['visualeditor-enable'] = 1; 

Wikis that are not open by default but require users from a certain user group to be logged in, in order to read and edit pages, require this additional line to be added to the LocalSettings.php:

$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true; 

This however has some implications on the security of the closed wiki. Since the parsoid renderer runs on the same machine and is addressed via localhost, this is not as dramatic, however it is advised to read the corresponding section in /var/www/MediaWiki_VisualEditor_Settings.php in order to understand the full implications of this action.

Enabling Other Namespaces

By default the Visual Editor is not enabled in all namespaces. To enable it for additional or even custom namespaces, just add a snippet like to the corresponding section of LocalSettings.php:

$wgVisualEditorAvailableNamespaces = [
	NS_HELP => true,
	NS_PROJECT => true,
	198 => true, //custom namespace
	"_merge_strategy" => "array_plus"

Trouble Shooting

Failed to include files

Problem: When the extension is added, the wiki page just shows an error message like this:

Fatal error: require_once(): Failed opening required '/var/www/v-wikiname/w/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php' (include_path='.:/var/www/v-wikiname/w:/var/www/v-wikiname/w/includes:/var/www/v-wikiname/w/languages:/usr/share/php/:/usr/share/php/PEAR/') in /var/www/MediaWiki_VisualEditor_Settings.php on line 10 

Cause of the Problem: For the wiki installation the symbolic link extension points to /usr/share/mediawiki26/extensions-simple-features instead of /usr/share/mediawiki26/extensions-rich-features. This can be easily verified by going into the directory of the wiki installation on the shell and running

ls -l | grep extension

The result will look like this:

lrwxrwxrwx  1 root     root       49 Mar 29  2016 extensions -> /usr/share/mediawiki26/extensions-simple-features

Solution To solve this issue, the correct extension directory needs to be linked to instead. Simply run the following commands:

rm extensions
ln -s /usr/share/mediawiki26/extensions-rich-features/ extensions