Difference between revisions of "Visual editor"

From Organic Design
Jump to: navigation, search
($wgVisualEditorNamespaces)
(Change source-code blocks to standard format)
Line 2: Line 2:
  
 
First download and unpack a snapshot for the extension corresponding to the wiki version as usual, then install ''nodejs'' with apt, but if your repo has an older version than 0.8, then remove it and install from [https://nodesource.com/ NodeSource] using the following commands (see [https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager this] for details).
 
First download and unpack a snapshot for the extension corresponding to the wiki version as usual, then install ''nodejs'' with apt, but if your repo has an older version than 0.8, then remove it and install from [https://nodesource.com/ NodeSource] using the following commands (see [https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager this] for details).
{{code|<bash>curl -sL https://deb.nodesource.com/setup | sudo bash -
+
<source lang="bash">
apt-get install nodejs</bash>}}
+
curl -sL https://deb.nodesource.com/setup | sudo bash -
 +
apt-get install nodejs
 +
</source>
  
  
 
Now install the ''paisoid'' package via apt (see [[MW:Parsoid/Setup]] for more detail). First add the key for the deb,
 
Now install the ''paisoid'' package via apt (see [[MW:Parsoid/Setup]] for more detail). First add the key for the deb,
{{code|<bash>gpg --keyserver keys.gnupg.net --recv-keys 6BF6E273
+
<source lang="bash">
gpg -a --export 6BF6E273 | sudo apt-key add -</bash>}}
+
gpg --keyserver keys.gnupg.net --recv-keys 6BF6E273
 +
gpg -a --export 6BF6E273 | sudo apt-key add -
 +
</source>
  
  
 
Then add the following to you ''/etc/apt/sources.list'' (only amd64 is available),
 
Then add the following to you ''/etc/apt/sources.list'' (only amd64 is available),
{{code|<pre>deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main</pre>}}
+
<source>
 +
deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main
 +
</source>
  
  
 
Then udpate and install it,
 
Then udpate and install it,
{{code|<pre>apt-get update
+
<source>
apt-get install parsoid</pre>}}
+
apt-get update
 +
apt-get install parsoid
 +
</source>
  
  
 
Edit the parsoid configuration (''/etc/mediawiki/parsoid/settings.js'') adding a line for each wiki in the wikia that will be using the editor, e.g.
 
Edit the parsoid configuration (''/etc/mediawiki/parsoid/settings.js'') adding a line for each wiki in the wikia that will be using the editor, e.g.
{{code|<pre>parsoidConfig.setInterwiki( '123', 'http://123.organicdesign.co.nz/wiki/api.php' );</pre>}}
+
<source>
 +
parsoidConfig.setInterwiki( '123', 'http://123.organicdesign.co.nz/wiki/api.php' );
 +
</source>
  
  
 
You may also like to lock down the ''parsoid'' daemon so it can only be accessed from the local host which you can do by editing ''/etc/default/parsoid'' and changing the ''INTERFACE'' setting from ''0.0.0.0'' to ''127.0.0.1''.
 
You may also like to lock down the ''parsoid'' daemon so it can only be accessed from the local host which you can do by editing ''/etc/default/parsoid'' and changing the ''INTERFACE'' setting from ''0.0.0.0'' to ''127.0.0.1''.
{{code|<pre>INTERFACE="127.0.0.1"</pre>}}
+
<source>
 +
INTERFACE="127.0.0.1"
 +
</source>
  
  
 
Restart the ''parsoid'' daemon and then test that you can read a page as follows (note the wiki ID matching the setting above):
 
Restart the ''parsoid'' daemon and then test that you can read a page as follows (note the wiki ID matching the setting above):
{{code|<bash>/etc/init.d/parsoid restart
+
<source lang="bash">
wget http://localhost:8142/123/Main_Page</bash>}}
+
/etc/init.d/parsoid restart
 +
wget http://localhost:8142/123/Main_Page
 +
</source>
  
  
 
Include the extension and its settings in the wiki's LocalSettings.php, e.g.
 
Include the extension and its settings in the wiki's LocalSettings.php, e.g.
{{code|<php>include( "$IP/extensions/VisualEditor/VisualEditor.php" );
+
<source lang="php">
 +
include( "$IP/extensions/VisualEditor/VisualEditor.php" );
  
 
// Enable by default for everybody
 
// Enable by default for everybody
Line 53: Line 68:
  
 
// Namespaces to enable VisualEditor in
 
// Namespaces to enable VisualEditor in
$wgVisualEditorNamespaces[] = NS_USER_TALK</php>}}
+
$wgVisualEditorNamespaces[] = NS_USER_TALK
 +
</source>
  
 
== Private wikis ==
 
== Private wikis ==
 
If you're running a private wiki (no public editing allowed) then you'll need to also set the following, but note that this means your cookie data is being sent over HTTP, so make sure you only do this if the ''parsoid'' daemon is on the localhost.
 
If you're running a private wiki (no public editing allowed) then you'll need to also set the following, but note that this means your cookie data is being sent over HTTP, so make sure you only do this if the ''parsoid'' daemon is on the localhost.
{{code|<php>$wgSessionsInObjectCache = true;
+
<source lang="php">
$wgVisualEditorParsoidForwardCookies = true;</php>}}
+
$wgSessionsInObjectCache = true;
 +
$wgVisualEditorParsoidForwardCookies = true;
 +
</source>
  
 
== SSD's ==
 
== SSD's ==

Revision as of 18:11, 22 May 2015

I'm creating a local page for this as it was quite difficult to install so I want some of my own notes for future reference. The main page for the extension is at MW:Extension:VisualEditor.

First download and unpack a snapshot for the extension corresponding to the wiki version as usual, then install nodejs with apt, but if your repo has an older version than 0.8, then remove it and install from NodeSource using the following commands (see this for details).

curl -sL https://deb.nodesource.com/setup | sudo bash -
apt-get install nodejs


Now install the paisoid package via apt (see MW:Parsoid/Setup for more detail). First add the key for the deb,

gpg --keyserver keys.gnupg.net --recv-keys 6BF6E273
gpg -a --export 6BF6E273 | sudo apt-key add -


Then add the following to you /etc/apt/sources.list (only amd64 is available),

deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main


Then udpate and install it,

apt-get update
apt-get install parsoid


Edit the parsoid configuration (/etc/mediawiki/parsoid/settings.js) adding a line for each wiki in the wikia that will be using the editor, e.g.

parsoidConfig.setInterwiki( '123', 'http://123.organicdesign.co.nz/wiki/api.php' );


You may also like to lock down the parsoid daemon so it can only be accessed from the local host which you can do by editing /etc/default/parsoid and changing the INTERFACE setting from 0.0.0.0 to 127.0.0.1.

INTERFACE="127.0.0.1"


Restart the parsoid daemon and then test that you can read a page as follows (note the wiki ID matching the setting above):

/etc/init.d/parsoid restart
wget http://localhost:8142/123/Main_Page


Include the extension and its settings in the wiki's LocalSettings.php, e.g.

include( "$IP/extensions/VisualEditor/VisualEditor.php" );

// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

// Specify which wiki from the parsoid configuration we're using
$wgVisualEditorParsoidURL = 'http://localhost:8142';
$wgVisualEditorParsoidPrefix = '123';

// Add organicdesign to the supported skins
$wgVisualEditorSupportedSkins[] = 'organicdesign';

// Namespaces to enable VisualEditor in
$wgVisualEditorNamespaces[] = NS_USER_TALK

Private wikis

If you're running a private wiki (no public editing allowed) then you'll need to also set the following, but note that this means your cookie data is being sent over HTTP, so make sure you only do this if the parsoid daemon is on the localhost.

$wgSessionsInObjectCache = true;
$wgVisualEditorParsoidForwardCookies = true;

SSD's

If you're system is running an SSD and you've gone through the SSD Optimisation checklist then you'll need to edit the start case in the /etc/init.d/parsoid file and have it create the /var/log/parsoid directory owned by parsoid. See the Nginx and MariaDB examples on that page for details.