Parsoid and VisualEditor

From 24PinTech Wiki
Jump to navigation Jump to search


About

Parsoid word logo.svg.png

VisualEditor is the plugin that allows MediaWiki to edit pages through the web format. It makes creating pages a seamless process with copy and paste functionality from Google Docs or anywhere else with formatting. VisualEditor runs through a service called Parsoid though. Parsoid takes the text inputted on the VisualEditor, and it parses it into wikitext.

Setup

To setup Parsoid with VisualEditor you have to configure two files.

LocalSettings.php

LocalSettings.php is located in the root directory of your website. In this file you must find where the extensions are loaded. If VisualEditor is not already loaded, you must load it manually. Add these following lines to the plugins. Our LocalSettings.php is located at /var/www/wiki.24pin.tech/LocalSettings.php

wfLoadExtension( 'VisualEditor' );

wfLoadExtension( 'Parsoid', __DIR__, '/vendor/wikimedia/parsoid/extension.json' );

Server Block Config

You will have to add the restbase server to your server block for this to work. Our server block is located at /etc/nginx/sites-available/wiki.24pin.tech

location /rest.php/ {

try_files $uri $uri/ /rest.php?$query_string;

}

These lines are just another location block that you will add at the end of your server block.

If that doesn't work

There could be a multitude of reasons that Parsoid does not work, so the best way to figure it out is researching. The only other fix I could recommend, is adding this to the end of your LocalSettings.php file.

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

$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

$wgHiddenPrefs[] = 'visualeditor-enable';


This is it... It's not as complicated as we thought.