VisualEditor: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
 
(91 intermediate revisions by the same user not shown)
Line 3: Line 3:
|about=The VisualEditor project aims to create a reliable rich-text editor for MediaWiki. [...] The extension relies on the separate nodeJS-based Parsoid parser service to be up and running in order to edit pages. Stable release is planned for 2014.
|about=The VisualEditor project aims to create a reliable rich-text editor for MediaWiki. [...] The extension relies on the separate nodeJS-based Parsoid parser service to be up and running in order to edit pages. Stable release is planned for 2014.
|logo=VisualEditor-logo.svg.png
|logo=VisualEditor-logo.svg.png
|screenshot=
|screenshot=MW1 24-visual-editor-test.png
|developers=
|author_location=Berlin
|author_location=Berlin
|licences=
|mediawiki=1.24 (or better). However, as of dec 2016, we recommend at least version 1.27. Also, installation and configuration procedures are different for older versions.
|description=
|dependencies=node.js, parsoid
|mediawiki=1.23 (or better)
|dependencies=
|related_text=
|discussion=
|languages=
|status=beta
|status=beta
|last_version=0.1.0 (as of June 2014)
|last_version=0.1.0 (as of April 2015). But there are several 0.1.0 subminor versions. E.g. on Dec 2016 it was (9da5996)
|programming language=
|programming language=JavaScript, PHP
|alternative=
|alternative=none
|website=https://www.mediawiki.org/wiki/Extension:VisualEditor
|website=https://www.mediawiki.org/wiki/Extension:VisualEditor
|publication=
|support_website=https://www.mediawiki.org/wiki/Extension:VisualEditor, https://www.mediawiki.org/wiki/VisualEditor,
|support_website=https://www.mediawiki.org/wiki/Extension:VisualEditor
|last_edit=2015/04/20
|example_website=
|last_edit=2014/06/20
}}
}}
The MediaWiki Visual Editor (operational since 2013 and more fully deployed on Wikipedia since 2014) is a Wysiwyg editor. It requires two components:
 
== Introduction ==
 
The [[Mediawiki]] VisualEditor is a Wysiwyg editor for Mediawiki versions that came out in late 2014. The system is also deployed in most Wikipedia versions (however since it is still in Beta, only registered users can use it). Installation of this extension is more complex than usual and requires two components:


* [https://www.mediawiki.org/wiki/Extension:VisualEditor Extension:VisualEditor]
* [https://www.mediawiki.org/wiki/Extension:VisualEditor Extension:VisualEditor]
* [https://www.mediawiki.org/wiki/Parsoid Parsoid]
* [https://www.mediawiki.org/wiki/Parsoid Parsoid], a combined MediaWiki and HTML parser implemented with [http://en.wikipedia.org/wiki/Node_js Node.js]


== MediaWiki 1.23 installation notes ==
I managed to get this installed and working, both on a test server and in this wiki. Anyhow, VisualEditor does seem work on MediaWiki 1.24 and 1.25 and 1.27 but the installation is very tricky and the software combination needs to be right. VisualEditor also seems to handle most pages that include templates and semantic forms. I don't think that semantic tags will work, but since we always use semantic forms that is more or less ok. Though, I consider moving forms-based pages into a special name space. Will have to do some extra testing however - [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 18:38, 26 June 2014 / Sept. 2015.


* Upgrade to the latest version
Notice: This extension sometimes breaks (depending on the combo of installed versions) - [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 15:48, 19 September 2014 -  [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 12:37, 17 April 2015 (CEST). Therefore upgrade your wiki on a test server first, if you are keen to have this working all the time.


cd installdir
== Installation notes for MW 1.27x under Ubuntu 16.x ==
git pull


=== Download and install the extension ===
It seems to be working for now - [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 20:01, 6 December 2016 (CET)


cd installdir
=== Pre-requisites ===
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
cd VisualEditor
git submodule update --init
: backtrack to an older version if needed!! E.g.:
git checkout REL1_23


=== Download and install the parsoid ===
* A node.js server and its npm package manager must be installed on your machine. To check if it exists, type <code>nodjs --version</code>


This depends on your OS. For Ubuntu 12.04 LTS you cannot use the official distro as explained in the [https://www.mediawiki.org/wiki/Parsoid/Setup official setup] documentation.
sudo apt-get install nodejs
sudo apt-get install npm


==== Install Parsoid ====
* Curl must be installed, including the php library.


Firstly edit the /etc/apt/sources.list file:
sudo apt-get install curl
  deb http://parsoid.wmflabs.org:8080/debian wmf-production/
sudo apt-get install php7.0-curl
  sudo apt-get install php-curl
sudo apachectl restart


Then get/install Parsoid
=== Installation of Parsoid ===
sudo apt-get update
sudo apt-get install parsoid


This will create:
Parsoid is a service that will run under node.js server and that will do the backend of the editing process, i.e. parse MediaWiki and HTML.
* a user ''parsoid'' (uid = 118)
* A Parsoid server that runs on port 8142


Check it it runs, e.g.
If you have old developper versions installed it could be a good idea to remove these.
  more /var/log/parsoid/parsoid.log
My new install only started working after:
  sudo apt-get --purge remove parsoid
  rm -r /usr/lib/parsoid
etc.
My system admin skills are fairly low and I cannot explain why I had to remove every trace of an old parsoid...


Files:
'''''Installing/upgrading parsoid'''''
/usr/lib/parsoid # the parsoid installation directory
/etc/default/parsoid # default settings
/etc/mediawiki/parsoid/settings.js # MEdiawiki-specific stuff
/var/log/parsoid/parsoid.log


==== Install NodeJS ====
sudo apt-key advanced --keyserver pgp.mit.edu --recv-keys 90E9F83F22250DD7
sudo apt-add-repository "deb https://releases.wikimedia.org/debian jessie-mediawiki main"
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install parsoid


Then get a different NodJS first
'''''Configure parsoid '''''
<source lang="bash">
sudo apt-get update
sudo apt-get install -y python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs=0.10*
</source>


Test if it's there:
Edit file /etc/mediawiki/parsoid/config.yaml
<source lang="bash">
nodejs --version
v0.10.28
</source>


=== Configure Parsoid ===
For each wiki, add two lines likes this under '''mwApis:''', one that defines the URL for the API and the other that gives a domain name (same as the one used in LocalSettings.php). Make sure the the API URL does work !
        mwApis:
        - # This is the only required parameter,
          uri: 'http://edutechwiki.unige.ch/test/api.php'
          domain: 'test'
        - # This is the only required parameter,
          uri: 'http://edutechwiki.unige.ch/your_wiki/api.php'
          domain: 'your_wiki'


==== Continue parsoid install ====
Restart parsoid:
sudo service parsoid restart


Go to the Parsoid '''source''' directory
=== Installation of the extension ===
cd /usr/lib/parsoid/src


Type
'''Normal users'''
npm install
: This will take a while and will download extra stuff. ''npm'' seems to be a kind of ''node'' management tool (yes I don't understand anything here...)


Test it (again in the src directory)
(tested with MW 1.31, Sept. 2018)
npm test


Your will get something like
Take the one from the official [https://www.mediawiki.org/wiki/Special:ExtensionDistributor/VisualEditor extensions directory] and just extract the archive.
3206 total passed tests (expected 3206), 1927 total failures (expected 1927)
--> NO UNEXPECTED RESULTS <--
==========================================================
WARNING: parserTests.txt not up-to-date with upstream.
        Run fetch-parserTests.txt.js to update.


==== Configure parsoid install ====
For example, '''do not use this, the URL will change'''
wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_31-13a585a.tar.gz


Create a localsettings.js file based on localsettings.js ???
'''Advanced users'''
cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
cd VisualEditor
git submodule update --init


  cd /etc/mediawiki/parsoid
Make sure to select the right version, 'master' probably will not work. Checkout the good version and '''update the submodule again'''
  git checkout REL1_27
git submodule update --init
'''but''', as we said above, for once it is a safer bet to get this extension from the distributor and not via git ....


Edit file ''settings.js'' to add your wiki
In LocalSettings.php:
parsoidConfig.setInterwiki( 'localhost', 'http://localhost/w/api.php' );
<source lang="php">


=== Configure the extension ===
# Visual Editor


In Localsettings.php:
wfLoadExtension( 'VisualEditor' );


<source lang="php">
# VISUAL Editor
require_once("$IP/extensions/VisualEditor/VisualEditor.php");
// OPTIONAL: Enable VisualEditor in other namespaces
// By default, VE is only enabled in NS_MAIN
//$wgVisualEditorNamespaces[] = NS_PROJECT;
// Enable by default for everybody
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['visualeditor-enable'] = 1;
 
// Optional: Set VisualEditor as the default for anonymous users
// otherwise they will have to switch to VE
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
 
// Don't allow users to disable it
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
$wgHiddenPrefs[] = 'visualeditor-enable';
 
// OPTIONAL: Enable VisualEditor's experimental code features
// OPTIONAL: Enable VisualEditor's experimental code features
//$wgVisualEditorEnableExperimentalCode = true;
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
 
$wgVirtualRestConfig['modules']['parsoid'] = array(
// URL to the Parsoid instance
// Use port 8142 if you use the Ubuntu or Debian packages
'url' => 'http://your.full.site:8142',
// Parsoid "domain" -- ADAPT TO YOUR NEED, i.e. replace "your_wiki" by the same "domain" name you gave in the yaml.config file.
'domain' => 'your_wiki'
);
</source>
</source>
=== Allow visual editing in more than default namespaces ===
Example (adapt to yours)
<source lang="php>
$wgVisualEditorAvailableNamespaces = [
                                      "0" => true,
                                      "2" => true,
                                      "102" => true,
                                      "104" => true,
                                      "106" => true,
                                      "_merge_strategy" => "array_plus"];
</source>
Tip: Look at the HTML source of [[Special:AllPages]]. The HTML options menu will list the numbers for your namespaces.
=== Troubleshooting ===
==== New installation is not working ====
It is really really crucial to get the URLs right in the various configuration files
1) Control if Apache is ok. On the command line, type:
  sudo apache2ctl -S
Depending on your installation you should get something like this (and not some random name that does not match your wiki URL !!)
VirtualHost configuration:
129.194.7.85:*        edutechwiki.unige.ch (/etc/apache2/sites-enabled/mediawiki.conf:1)
Make very sure that in your Apache mediawiki.conf file you get the right name of your Internet alias, for example:
  <VirtualHost edutechwiki.unige.ch>
  ServerAdmin ....@.....
        ServerName edutechwiki.unige.ch
2) Make sure that the Parsoid domain is correct and consistent.
3) Uninstall old code and configuration files and start fresh.
==== Parsoid did work and stopped working ====
This arrived on March 28, 2018, Ubuntu Server 16.04 / Mediawiki 1.27.4. According to [https://www.mediawiki.org/wiki/Extension_talk:VisualEditor a post on Mediawiki] one should install an old version. Firstly make sure that this is the problem
apt-cache show parsoid
If it shows ''pool/main/p/parsoid/parsoid_0.9.0all_all.deb'' then you got version 9 and you could try downgrading. It's probably safer than trying to install a new visual editor that also can break everything, but I just do not know. Also make sure to copy the configuration files in case they go away.
apt-get purge parsoid
wget https://people.wikimedia.org/~ssastry/parsoid/debs/parsoid_0.8.0all_all.deb
dpkg -i parsoid_0.8.0all_all.deb
apt-mark hold parsoid
Remember what you did here. <code>apt-mark hold</code> prevents installing a new package. Revert this after installing a new evething ...
  apt-mark unhold parsoid
===  https support ===
* Is possible, read the [https://www.mediawiki.org/wiki/Extension:VisualEditor#Parsoid_over_HTTPS official manual page] (not tested so far)
* Requires getting and installing certificates...
== Tips for old version ==
I had VisualEditor going for MW 1.25. After that it broke. You can browse through the wiki history if you are really interested in that ...
[[category: Mediawiki documentation]]

Latest revision as of 15:51, 13 September 2018

Category:MediaWiki extension
VisualEditor
Extension name VisualEditor
About this article / disclaimer [[Has about meta information::The VisualEditor project aims to create a reliable rich-text editor for MediaWiki. [...] The extension relies on the separate nodeJS-based Parsoid parser service to be up and running in order to edit pages. Stable release is planned for 2014.]]
Logo VisualEditor-logo.svg.png
Screenshot MW1 24-visual-editor-test.png
Location of the main author Berlin
Coordinates of the main authors 52.510885, 13.398937
Developers
Licences
Description
Mediawiki requirements 1.24 (or better). However, as of dec 2016, we recommend at least version 1.27. Also, installation and configuration procedures are different for older versions.
Dependencies node.js, parsoid
Related extensions (documented here)
Related extensions
Discussion
Language support
Status beta
First release date
Last release date (as of 2015/04/20!)
Last version number 0.1.0 (as of April 2015). But there are several 0.1.0 subminor versions. E.g. on Dec 2016 it was (9da5996)
Programming language JavaScript, PHP
Alternatives none
Website home page
Publications
Support websites web site, web site
Example websites
Last edited 2015/04/20


Introduction

The Mediawiki VisualEditor is a Wysiwyg editor for Mediawiki versions that came out in late 2014. The system is also deployed in most Wikipedia versions (however since it is still in Beta, only registered users can use it). Installation of this extension is more complex than usual and requires two components:

I managed to get this installed and working, both on a test server and in this wiki. Anyhow, VisualEditor does seem work on MediaWiki 1.24 and 1.25 and 1.27 but the installation is very tricky and the software combination needs to be right. VisualEditor also seems to handle most pages that include templates and semantic forms. I don't think that semantic tags will work, but since we always use semantic forms that is more or less ok. Though, I consider moving forms-based pages into a special name space. Will have to do some extra testing however - Daniel K. Schneider (talk) 18:38, 26 June 2014 / Sept. 2015.

Notice: This extension sometimes breaks (depending on the combo of installed versions) - Daniel K. Schneider (talk) 15:48, 19 September 2014 - Daniel K. Schneider (talk) 12:37, 17 April 2015 (CEST). Therefore upgrade your wiki on a test server first, if you are keen to have this working all the time.

Installation notes for MW 1.27x under Ubuntu 16.x

It seems to be working for now - Daniel K. Schneider (talk) 20:01, 6 December 2016 (CET)

Pre-requisites

  • A node.js server and its npm package manager must be installed on your machine. To check if it exists, type nodjs --version
sudo apt-get install nodejs
sudo apt-get install npm
  • Curl must be installed, including the php library.
sudo apt-get install curl
sudo apt-get install php7.0-curl
sudo apt-get install php-curl
sudo apachectl restart

Installation of Parsoid

Parsoid is a service that will run under node.js server and that will do the backend of the editing process, i.e. parse MediaWiki and HTML.

If you have old developper versions installed it could be a good idea to remove these. My new install only started working after:

sudo apt-get --purge remove parsoid
rm -r /usr/lib/parsoid
etc.

My system admin skills are fairly low and I cannot explain why I had to remove every trace of an old parsoid...

Installing/upgrading parsoid

sudo apt-key advanced --keyserver pgp.mit.edu --recv-keys 90E9F83F22250DD7
sudo apt-add-repository "deb https://releases.wikimedia.org/debian jessie-mediawiki main"
sudo apt-get install apt-transport-https 
sudo apt-get update
sudo apt-get install parsoid

Configure parsoid

Edit file /etc/mediawiki/parsoid/config.yaml

For each wiki, add two lines likes this under mwApis:, one that defines the URL for the API and the other that gives a domain name (same as the one used in LocalSettings.php). Make sure the the API URL does work !

       mwApis:
       - # This is the only required parameter,
         uri: 'http://edutechwiki.unige.ch/test/api.php'
         domain: 'test'
       - # This is the only required parameter,
         uri: 'http://edutechwiki.unige.ch/your_wiki/api.php'
         domain: 'your_wiki'

Restart parsoid:

sudo service parsoid restart

Installation of the extension

Normal users

(tested with MW 1.31, Sept. 2018)

Take the one from the official extensions directory and just extract the archive.

For example, do not use this, the URL will change

wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_31-13a585a.tar.gz

Advanced users

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/VisualEditor.git
cd VisualEditor
git submodule update --init

Make sure to select the right version, 'master' probably will not work. Checkout the good version and update the submodule again

git checkout REL1_27
git submodule update --init

but, as we said above, for once it is a safer bet to get this extension from the distributor and not via git ....

In LocalSettings.php:

# Visual Editor

wfLoadExtension( 'VisualEditor' );

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

// Optional: Set VisualEditor as the default for anonymous users
// otherwise they will have to switch to VE
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

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

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

$wgVirtualRestConfig['modules']['parsoid'] = array(
	// URL to the Parsoid instance
	// Use port 8142 if you use the Ubuntu or Debian packages
	'url' => 'http://your.full.site:8142', 
	// Parsoid "domain" -- ADAPT TO YOUR NEED, i.e. replace "your_wiki" by the same "domain" name you gave in the yaml.config file.
	'domain' => 'your_wiki'
);

Allow visual editing in more than default namespaces

Example (adapt to yours)

$wgVisualEditorAvailableNamespaces = [
                                      "0" => true,
                                      "2" => true,
                                      "102" => true,
                                      "104" => true,
                                      "106" => true,
                                      "_merge_strategy" => "array_plus"];

Tip: Look at the HTML source of Special:AllPages. The HTML options menu will list the numbers for your namespaces.

Troubleshooting

New installation is not working

It is really really crucial to get the URLs right in the various configuration files

1) Control if Apache is ok. On the command line, type:

 sudo apache2ctl -S

Depending on your installation you should get something like this (and not some random name that does not match your wiki URL !!)

VirtualHost configuration:
129.194.7.85:*         edutechwiki.unige.ch (/etc/apache2/sites-enabled/mediawiki.conf:1)

Make very sure that in your Apache mediawiki.conf file you get the right name of your Internet alias, for example:

 <VirtualHost edutechwiki.unige.ch>
  	ServerAdmin ....@.....
       ServerName edutechwiki.unige.ch

2) Make sure that the Parsoid domain is correct and consistent.

3) Uninstall old code and configuration files and start fresh.

Parsoid did work and stopped working

This arrived on March 28, 2018, Ubuntu Server 16.04 / Mediawiki 1.27.4. According to a post on Mediawiki one should install an old version. Firstly make sure that this is the problem

apt-cache show parsoid

If it shows pool/main/p/parsoid/parsoid_0.9.0all_all.deb then you got version 9 and you could try downgrading. It's probably safer than trying to install a new visual editor that also can break everything, but I just do not know. Also make sure to copy the configuration files in case they go away.


apt-get purge parsoid
wget https://people.wikimedia.org/~ssastry/parsoid/debs/parsoid_0.8.0all_all.deb
dpkg -i parsoid_0.8.0all_all.deb
apt-mark hold parsoid

Remember what you did here. apt-mark hold prevents installing a new package. Revert this after installing a new evething ...

 apt-mark unhold parsoid

https support

  • Requires getting and installing certificates...

Tips for old version

I had VisualEditor going for MW 1.25. After that it broke. You can browse through the wiki history if you are really interested in that ...