Extension talk:VisualEditor

About this board

Please note that the Wikimedia Foundation does not provide support for installing VisualEditor on third-party wikis. However, if you have a question we may try to help.

Extending VisuaEditor, need some pointer

1
EmmanuelIstace (talkcontribs)

Hi,

I'm a developer and I want to add a button to the visual editor, when clicked, a popup appear showing some texte box, when validated, the wikicode is updated according to the textebox value.

I browsed the VisualEditor code base, and I'm totally lost.

Where should I start ? What files should I be interested in ? Which methods ?

Best regards

Reply to "Extending VisuaEditor, need some pointer"

(Curl error: 60) SSL peer certificate or SSH remote key was not OK (MediaWiki 1.35 + VisualEditor + Windows/IIS)

10
Configmaster (talkcontribs)
Product Version
Mediawiki 1.35.0
PHP 7.3.24
MariaDB 10.5.8
IIS 10
OS Windows Server 2019

Symptoms:

New installation of private MediaWiki 1.35 with Visual Editor. IIS configured to use Windows Authentication (to enable authentication with Windows AD). MW works as excepted, launching VE causes Curl error 60.

VisualEditor documentation states that with MediaWiki 1.35, you should not need to download anything to get VE working, private wiki may need some configuration but otherwise VE should work out of the box.

Many hours (days) and lots of research later I can say, that getting VE work with MediaWiki 1.35 on Windows environment wasn’t such an easy task. I found lots of suggestions how to get VE work after “Error contacting the Parsoid/RESTBase server: (Curl error: 60) SSL peer certificate or SSH remote key was not OK”, but none of them worked for me.


Workaround:

This is my solution (quite simple, actually), hope this helps someone to get things working without days of work and banging head to the wall.

1. Install MediaWiki 1.35 with extensions of your choice.

2. Make sure that everything is working like you want (except that stubborn VisualEditor that gives you Curl error 60)

3. Export CA-certificate and add reference to it in php.ini -conf (*

4. Modify authentication settings of rest.php -file in IIS (**

5. Add following lines to LocalSettings.php

if($_SERVER['REMOTE_ADDR'] == 'your_server_ip_address'){

$wgGroupPermissions['*']['edit'] = true;

$wgGroupPermissions['*']['read'] = true;

}

6. Make iisreset


(* If I get it right, the Curl 60 is generated when you click on modify in MediaWiki, which leads to connection attempt to VE through PHP that can't verify the server certificate in use. To fix this error you need to export the CA-certificate and tell the PHP where it is found:

1. Open mmc → Add/Remove Snap-in → Certificates → Computer account

2. In certificates -console navigate to Trusted Root Certification Authorities → Certificates

3. Select your Root CA → Export → Base-64 encoded X.509 (.CER) (this is equivalent to .pem -certificate format) → Save to the wiki root -folder (same place where is your LocalSettings.php) with name “cacert.cer”

4. Go to your PHP install folder and find php.ini → find line ;curl.cainfo =

5. Remove ; and add absolute path to your exported cacert.cer -file, example: curl.cainfo = “c:\WIKI\cacert.cer”


Now the curl 60 should disappear, you can verify that by changing the IIS authentication settings to Anonymous Authentication and authenticating with log in form.


(** SSO wont work if you have Anonymous Authentication enabled in IIS and VE wont work if it is disabled. This is a problem if you use something else than username/password to authenticate users (you know what I mean if you have smart cards in use).

You can tackle the authentication problem by setting the Anonymous Authentication only to the rest.php -file (found in you wiki root) and everywhere else you can use Windows Authentication and keep the Anonymous Authentication disabled:

1. Navigate to your %windir%\system32\inetsrv\config directory and modify applicationHost.config

2. Search <location path=”your_wiki_site”> … </location> section and add a new section below it:

<location path=”your_wiki_site/rest.php”>

<system.webServer>

<security>

<authentication>

<anonymousAuthentication enabled=”true” />

</authentication>

</security>

</system.webServer>

</location>

3. Save your changes to the config file and make an iisreset.


Now you should have working MediaWiki with Visual Editor.

89.166.216.113 (talkcontribs)

I could not import my certificate in the cert store, so I added the ignore option for curl to get it running:

edit includes/libs/http/MultiHttpClient.php

                $ch = curl_init();

+                curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

+                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

                curl_setopt( $ch, CURLOPT_PROXY, $req['proxy'] ?? $this->proxy );


Now curl does not check my certificate, but it works.

81.220.61.63 (talkcontribs)

Did that fix and it worked like a charm. Thanks for sharing !


NB: It's a private Wiki too, not open on public internet

217.110.33.34 (talkcontribs)

THANK YOU !!!!!!!!!!

88.130.78.70 (talkcontribs)

After hours of search & try I finally found a solution for my private wiki.


Here are my steps and solution. Maybe they will help someone.

- See what is the problem:

curl --trace-ascii trace.txt wiki-adress/api.php

My curl.cainfo in the php.config was not used. In the trace.txt I found the path.


- The I added my SSL cert at the end of ca-certificates.crt

sudo nano /etc/ssl/certs/ca-certificates.crt

   -> add private cert at the end


- I use NGINX with htaccess protection. But now I got a 401 error. Thats why I disabled the auth*

-> remove auth_* in NGINX config

   server {

       auth_basic "Restricted";

       auth_basic_user_file /etc/nginx/.htpasswd;

   }


- Now I got a 400 error. I added following line in NGINX config:

     location /rest.php/ {

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

       }

sudo nginx -t

sudo systemctl reload nginx


This finally worked for me.

Unfortunatelly I have no more htaccess protection.

KarelMike (talkcontribs)

I have same error (Curl error: 60) with MW 1.35.2 working on the virtual server (Ubuntu 20.04, Apache2, PHP 7.4.3, MySQL 8.0.25). I have assumption that error arise from NGNIX - Apache bundle, where Apache works throwout 127.0.0.1 localhost.

I don't knew, how to fix this. No one of presented here methods don't work for me.

Lokeshwarans (talkcontribs)

Thanks this is good! Do you face any issues with image uploads? I get a Could not open lock file for "mwstore://local-backend/local-public/ while uploading

Fokebox (talkcontribs)

I have some wiki websites on different hosts and yesterday when using VE I faced with the same error: (Curl error: 60) SSL peer certificate or SSH remote key was not OK

What steps should be made to resolve this problem I really don't know. Can someone help me?

95.57.117.162 (talkcontribs)

     location /rest.php/ {

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

       }


This worked for me, thanks!

2001:9E8:303B:7900:412F:8C5C:22AC:71D3 (talkcontribs)

How do I "Export CA-certificate"?

Thanks in advance!

Christian

Reply to "(Curl error: 60) SSL peer certificate or SSH remote key was not OK (MediaWiki 1.35 + VisualEditor + Windows/IIS)"
95.223.2.40 (talkcontribs)

Is it possible to add an option to select a Textcolor? Unfortunately at the moment this is only possible with some html additions but not with the visual editor.

Reply to "Textcolor"

VisualEditor timeout on MW 1.35

2
C holtermann (talkcontribs)

For big pages the VisualEditor times out. The log contains messages like:

[Mon Nov 15 13:19:04.545572 2021] [fcgid:warn] [pid 363488] (104)Connection reset by peer: [client XXX] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

[Mon Nov 15 13:19:44.692546 2021] [fcgid:warn] [pid 373859] (32)Broken pipe: [client XXX] mod_fcgid: ap_pass_brigade failed in handle_request_ipc function

I learned that this results not so much from server but client timeout. Searching the source for the error message I got to mw message 'api-clientside-error-timeout'. This gets triggered after 30seconds. I manually raised that delay to two minutes (https://github.com/wikimedia/mediawiki/blob/ff7a116541249b67260f3c21d8ba2987f73649f0/resources/src/mediawiki.api/index.js#L75). This seems to do the trick for me.

Why is this hardcoded and not configurable?

Dimka665 (talkcontribs)

It's actual still

Reply to "VisualEditor timeout on MW 1.35"

Editing a previous revision does not diff against current page

1
Iritscen (talkcontribs)

I have sometimes wanted to edit a page by starting from a revision before the current one – by clicking "Edit" on an older version of the page – so that I can start from what I consider to be a better revision of the page. Suppose that the latest revision was a step down overall, but with a couple points worth preserving. In the past, I could edit an older revision without losing track of subsequent changes by using the "Review your changes" button. I would be shown the effect my work-in-progress edit will have on the current page, which would allow me to take the last edit into account in case I want to copy and preserve some of those changes.

I have been troubled recently to see that the changes shown in the "review" are based on whatever revision comes before the one I am editing, not the current page. Yet when I click "Publish changes…" I will be making a change that is based on the current page. The preview should reflect the actual difference I will be making to the current state of the page, should it not? I'm not sure if this is a recent change in the extension or if I am more accustomed to the previous editors used on Wikipedia and am just now noticing this change in behavior in the new one.

Reply to "Editing a previous revision does not diff against current page"

How to hide the “Save your changes” confirmation window when saving a page on Mediawiki

10
Paulxu20 (talkcontribs)

I have a personal wiki running on mediawiki and don't think I really need to track the page edit summary or whatsoever, so is there anyway to skip it? which means when I am done with editing on a page and click on Save, it just Save the page without asking me to describe what I changed..

Thank you!

195.65.170.10 (talkcontribs)

Did u find a way to this problem or is it still unsolved?

Paulxu20 (talkcontribs)

Not yet.

Michael Z Freeman (talkcontribs)

Looking for this as well.

2003:DF:9F2D:6E00:6059:29B5:482F:F412 (talkcontribs)

Would appreciate a solution for this as well!

DanShearer (talkcontribs)

Hello all,

I have had a quick look at this, and decided it was too much of a specific hack. But for all of you asking this question, see the file:

 VisualEditor/modules/ve-mw/init/targets/ve.init.mw.ArticleTarget.js

where you will find this function:

 ve.init.mw.ArticleTarget.prototype.showSaveDialog

and I'm pretty sure that is where the magic happens. It isn't just a simple case of saying "skip the dialogue" because there are numerous messages that are handled.

HtH,

DanShearer (talk) 01:25, 11 December 2022 (UTC)

81.59.58.232 (talkcontribs)

Adding this at the beginning of ve.init.mw.ArticleTarget.prototype.showSaveDialog


this.save(this.getDocToSave(), this.getSaveOptions());

this.tryTeardown(true);

return;


Seems to save the changes without annoying popup and leave the editing mode. But it still requires a manual page refresh (or clicking the Page tab) to see the saved changes.

81.59.58.232 (talkcontribs)

Read tab, not the Page tab

81.59.58.232 (talkcontribs)

Well both are fine actually ;-)

Reply to "How to hide the “Save your changes” confirmation window when saving a page on Mediawiki"

How to enable Insert "Code Block" CodeEditor?

2
76.93.216.184 (talkcontribs)

I am using MediaWiki 1.35, which comes with VisualEditor and CodeEditor extensions. Both are enabled in my LocalSettings.php:


wfLoadExtension( 'VisualEditor' );

wfLoadExtension( 'CodeEditor' );


However, in the "Insert" menu of my Visual Editor, I do not see the "Code block" option that I have experimented with on the Mediawiki sandbox page. How do I enable this? It would be very useful for our tech team support.

Escalatr (talkcontribs)
Reply to "How to enable Insert "Code Block" CodeEditor?"

1.39.2 message on the wiki

2
Schub srx (talkcontribs)

The release from 1.38.4 to 1.39.2 is ok but i ve this message on the top of my wiki

what do i ve to do?


Use of SkinTemplateNavigation hook (used in VisualEditorHooks::onSkinTemplateNavigation) was deprecated in MediaWiki 1.39. [Called from MediaWiki\HookContainer\HookContainer::run in /homepages/3/d938089406/htdocs/clickandbuilds/MediaWiki/Srxteam/includes/HookContainer/HookContainer.php at line 137] in /homepages/3/d938089406/htdocs/clickandbuilds/MediaWiki/Srxteam/includes/debug/MWDebug.php on line 381

Schub srx (talkcontribs)

it 's gone

Reply to "1.39.2 message on the wiki"

error message whith the modification button

2
Schub srx (talkcontribs)

Error contacting the Parsoid/RESTBase server (HTTP 500)


i m on the 1.39.2 (before on 1.38.4)

Something wrong with an extension ?

Schub srx (talkcontribs)

i ve reinstalle the extension visual editor with the file include in the 1.39.2 rellease

the message is gone :) , but the blue progress bar stop at the 2/3?

Reply to "error message whith the modification button"

VE most often does not display last version

3
Jppialasse (talkcontribs)

I have a mediawiki instance behind a httpd reverse proxy.

VE is installed and configured for 1.35. The instance is using MEMCACHED as Cache Type.

Communication between the mediawiki httpd and the reverse proxy is without ssl (http), and the proxy does the encryption to https before delivering to client.

I am able to edit pages, it works great apart 2 issue:

1 Major Issue is that most of the time if you do two edits in a row, on the second edit it will display to edit the previous version of the page leaving you to erase your previous edit. Is there a configuration to avoid this ?


2 smaller issue links to pictures in the page are rendered as http, so browsers will not display them as the final communication is https . Is there a way to force parsoid to use https inside the code even if the mediawiki is configured as simple http behind a https proxy?

Jppialasse (talkcontribs)

answering to myself in case someone has same issue, this was caused by using mod_expires. If you do so take care to define an entry for json, to avoid browser caching the result:

ExpiresDefault "access plus 1 days"

ExpiresByType application/json "access"

ProbablyDrew (talkcontribs)

Thanks for posting this, I kept getting blank or outdated pages in visualeditor and search results were yielding nothing but dead ends.


I became convinced it was some local browser setting for a while before finding this post. Adding the json line to my apache mod_expires config resolved the issue. :)

Reply to "VE most often does not display last version"
Return to "VisualEditor" page.