Getting VisualEditor to switch between source and visual editing

extensions
visualeditor
restbase
parsoid

#1

I am not sure if this is the right forum. I fail to get VisualEditor working with RESTBase for switching between source and visual editing.

VisualEditor is working fine with the following setting:

## VisualEditor
wfLoadExtension( 'VisualEditor' );
$wgVisualEditorAvailableNamespaces = [
    NS_EXTRA => true
    ];
$wgVirtualRestConfig['modules']['parsoid'] = [
    'url' => 'https://wiki.example.org:8143',
    'domain' => 'wiki.example.org'
    ];

This works great. Visual editing is possible.

Now I also set up RESTBase which is accessible and running via https://wiki.example.org:7232/wiki.example.org/v1/ If I do curl https://wiki.example.org:7232/wiki.example.org/v1/page/html/Main_Page I get the expected results.

However when I add I get issues:

$wgVirtualRestConfig['modules']['restbase'] = [
    'url' => 'https://wiki.example.org:7132',
    'domain' => 'wiki.example.org'
    ];
$wgVisualEditorRestbaseURL = 'https://wiki.example.org:7232/wiki.example.org/v1/page/html/';
$wgVisualEditorFullRestbaseURL = 'https://wiki.example.org:7232/wiki.example.org/';

Setting https://wiki.example.org:7132/wiki.example.org/ to url and other variations does not help either.

I just continue to get “curl error: 7” errors.


#2

Curl error 7 seems to be a problem to connect to the host. If you can connect to it from outside of the host, but not from PHP, check to see there is not a SELinux configured to block PHP from doing external requests.


#3

Thanks a lot for your reply. No SELinux is not in use on that machine. So it must be something else. I will try sometime later.

I believe the issue lies within the requirement to server RESTbase via https. Using http is not possible I guess since the browser would automatically block user actions.

Perhaps somebody has a clue how to set up RESTbase via https. Any input on this will be appreciated.


#4

I’m currently trying to set up RESTBase and yeah, the lack of documentation makes it difficult. I have nginx as a frontend, and making requests to /api/rest_v1 be routed to the internal RESTBase server (acting like a proxy), so there’s no problem in serving it through https like the rest of the web. I guess this can also be done with apache. And this is probably desired, since having RESTBase on a different port can cause problems to users behind a corporate firewall/proxy, that usually block any port that isn’t the default 80/443


#5

I think I am having an issue similar to this.

My server set up is a little weird but he it goes:

I have my personal portfolio website which is on shared hosting at ‘example.com

I use my paid host for my domain and DNS. I set up a subdomain for https://cloud.example.com for my personal cloud server. My personal cloud server works fine. My personal cloud server is hosted on my personal desktop server which is in my house.

I set up a subdomain for wiki.example.com and it is working. I tried to install the Visual Editor and it worked for creating new pages. But if I try to edit a page it doesn’t. So I followed the instructions for setting up Parsoid and it is still not working properly. I keep getting the following error:

Error loading data from server: apierror-visualeditor-docserver-http-error: (curl error: 7) Couldn't connect to server. Would you like to retry?

The really weird thing is that in the process of having these issues I actually had it work ONE time, I was able to use the editor! So I made a changed, saved it, and then refreshed the page to see if it had properly saved and it had, but once I tried to edit it again after that, it wouldn’t work! I have no clue why, or what it was I did…

I also found the Parsoid set up instructions very difficult to follow and confusing. After trying a bunch of different things I finally decided to start over and try this tutorial: https://www.howtoforge.com/tutorial/how-to-install-visualeditor-for-mediawiki-on-centos-7/

I found it much easier to follow but in the end, the thing still isn’t working. I don’t know if following those instructions have muddled the water and perhaps screwed up my attempt further by having two conflicting Parsoid installation attempts or something but as it stands this is the only thing I know how to do.


#7

As mentioned above, you will need to have RESTBase [1] installed additionally to Parsoid if you want to switch between WikiText and Visual mode. But be aware that this kind of setup will probably not work with a private wiki setup (aka “anonymous users are not allowed to read”-wikis) [2].

[1] https://www.mediawiki.org/wiki/RESTBase/Installation
[2] https://www.mediawiki.org/wiki/Extension:VisualEditor#Switching_between_Wikitext_Editing_and_VisualEditor


#8

@Osnard I was able to get stuff working as documented here: https://phabricator.wikimedia.org/T207504

I don’t believe I actually have the RestBase thing working though.