Page MenuHomePhabricator

wikieditor is not loaded when using the editor=wikieditor option in texarea fiels on MediaWiki 1.33.1
Closed, ResolvedPublic

Description

wikieditor is not loaded when using the editor=wikieditor option in texarea fiels on MediaWiki 1.33.1.

The problem is in the javascript code of the PF_wikieditor.js file, because it calls mw.loader.using passing [ 'jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config' ] as the first parameter, however, it seems that in the latest release of wikieditor those modules are not loaded, I think this is the commit where this was changed: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikiEditor/+/d23d09628122881bf4bcc91d2bc56c169019dbf8.

To fix this, the line

mw.loader.using( [ 'jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config' ] , function() {

can be replaced by

$.when( mw.loader.using( 'ext.wikiEditor' ), $.ready ).then( function() {

as shown in https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization

Also, I think that the call to $.wikiEditor.isSupported can be removed. The function isSupported was removed from wikieditor (in commit https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiEditor/+/400697), because, as stated in the commit message, "WikiEditor works in all browsers that MW supports".

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 24 2019, 1:42 PM

Change 552655 had a related patch set uploaded (by Tombolano; owner: Tombolano):
[mediawiki/extensions/PageForms@master] Fix for wikieditor not being loaded on MediaWiki 1.33

https://gerrit.wikimedia.org/r/552655

@Tombolano - thank you for this fix. Is this backward-compatible? Page Forms is still meant to support MediaWiki (and thus WikiEditor) versions going back to 1.28.

I tested the code on MediaWiki 1.33.1 (wikieditor 0.5.2) and MediaWiki 1.31.5 (wikieditor 0.5.1) and worked fine.

I have just tested the code in MediaWiki 1.28.3 (wikieditor 0.5.0) and wikieditor didn't load, oops...

It seems that for wikieditor 0.5.0 we should wait for the jquery modules to load. I dind't think this would be a problem, in the toolbar customization docs (https://www.mediawiki.org/wiki/Extension:WikiEditor/Toolbar_customization.) the code shown to customize the toolbar only waits for ext.wikieditor, and the docs state that this is for MW 1.26+.

I have uploaded a second patch where I check the MediaWiki version and if it is lower than 1.33 then the code waits for the jquery modules, else the code waits for the ext.mediawiki module. I also left the calls to the isSupported function, I think that they are not needed, but anyway they do not do any harm. I have checked this patch in the MW versions I said before and now the wikieditor works fine.

Change 552655 merged by jenkins-bot:
[mediawiki/extensions/PageForms@master] Fix for wikieditor not being loaded on MediaWiki 1.33

https://gerrit.wikimedia.org/r/552655

Yaron_Koren closed this task as Resolved.Nov 24 2019, 11:34 PM
Yaron_Koren claimed this task.

Thank you for this patch! It looks great.