Page MenuHomePhabricator

WikiText content provided by hook `EditFormPreloadText` gets converted to HTML even if VE is in WikiText mode
Closed, ResolvedPublic

Description

When e.g. inserting the following WikiText using the EditFormPreloadText hook ...

* ABC
* DEF

... and VisualEditor starts in WikiText mode (e.g. because visual mode is disabled for target namespace), VisualEditor shows ...

<ul id="mwAQ"><li id="mwAg"> ABC</li>
<li id="mwAw"> DEF</li></ul>

... in the edit area. This is due to a missing check for paction parameter in ApiVisualEditor.php

There is a patch for REL1_31 available: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/VisualEditor/+/466665/

If accepted, this should probably be cherry-picked to master and REL1_32.

Event Timeline

Change 466665 had a related patch set uploaded (by Esanders; owner: Nasty):
[mediawiki/extensions/VisualEditor@REL1_31] Fix parse wikitext fragment in paction wikitext.

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

Change 466949 had a related patch set uploaded (by Bartosz Dziewoński; owner: Nasty):
[mediawiki/extensions/VisualEditor@master] Fix parse wikitext fragment in paction wikitext.

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

There is no REL1_32 branch yet, as far as I can see. I don't think it has been cut yet, so the patch in master should be automatically included in it.

There is no REL1_32 branch yet, as far as I can see. I don't think it has been cut yet, so the patch in master should be automatically included in it.

It'll get cut in five days' time.

Change 466949 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Fix parse wikitext fragment in paction wikitext.

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

Change 466665 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@REL1_31] Fix parse wikitext fragment in paction wikitext.

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

I've looked at extensions using the EditFormPreloadText hook and it turns out this problem can be reproduced on Wikimedia projects as well, so asking for QA review.

The only case I've found is creating an info page for a new Wikimedia project on Incubator, for example: https://incubator.wikimedia.org/w/index.php?title=Wp/qaa&action=edit (please don't actually save that page, I have no idea how Incubator works, they might get upset).

image.png (980×1 px, 254 KB)

Expected preloaded content is like this (using old wikitext editor here):

image.png (980×1 px, 131 KB)

(Among Wikimedia-deployed extensions, 'EditFormPreloadText' hook is also used by the ProofreadPage, extension but it appears you can't load the new wikitext editor on pages that would be affected.)

@JTannerWMF/@matmarex I need clearer QA steps to understand what to test here.

marcella claimed this task.