Page MenuHomePhabricator

FileImporter "Edit File Info" not compatible with 2017 wikitext editor
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

List of steps to reproduce:

What happens?:
The button briefly loads the default wikitext editor, which is prefilled with the existing file info wikitext. This is quickly replaced by the 2017 wikitext editor, but it is blank.

What should have happened instead?:
The 2017 wikitext editor should be prefilled with the existing file info wikitext, or it should at least gracefully fall back to just using the default wikitext editor.

Event Timeline

matmarex subscribed.

I blame FileImporter, it mimics the normal editor too well, and tricks the 2017 wikitext editor into thinking that you're trying to edit a normal file description page.

We could make the 2017 wikitext editor keep the prefilled wikitext, but that wouldn't fix the issue – if you went through the editing and published, it would probably immediately create the file page (without a file) with your wikitext. More complicated changes would be needed to make it return to FileImporter.

This bug also occurs without 2017 wikitext editor, when only visual editor is enabled – the edit interface lets you switch to visual mode, which would immediately save the page instead of returning to FileImporter:

image.png (2×3 px, 229 KB)

If FileImporter needs to mimic the editor so closely, then the fix is probably to explicitly disable VisualEditor on this page, similar to 3ba918a6aecafc0880ec82cbe5602804117477ad or a0af0b05299a3f9e96ace3cdf84cf83e40f5ea0e.

thiemowmde subscribed.

I did a bit of investigation, but couldn't find a quick and easy solution.

  • It's indeed like @matmarex says, FileImporter "mimics the normal editor too well".
  • This is necessary to enable the 2010 WikiEditor (2010) toolbar as well as MediaWiki-extensions-CodeMirror syntax highlighting.
  • Making this less perfect would not only disable VE, but also the features we want.
  • I tried a lot of things to somehow disable VE from FileImporter: Not load the VE RL module in the first place; force some user option to disable VE; trick the VE initialization into thinking it can't work; use a fake namespace where VE doesn't work; … These attempts all have the same issues: There is currently no way to do this. And even if, most ideas depend on a specific loading order.
  • Somehow using an extension.json attribute to disable VE from another extension might be an option (example).

Hard-coding an extra check in VE – as suggested by @matmarex – is probably the best option for now.

Change 756599 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/VisualEditor@master] Allow disabling VE and 2017 wikitext editor from FileImporter

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

Change 756600 had a related patch set uploaded (by WMDE-Fisch; author: WMDE-Fisch):

[mediawiki/extensions/FileImporter@master] Disable VE and 2017 wikitext editor on Edit File Info

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

WMDE-Fisch set the point value for this task to 2.Jan 24 2022, 2:24 PM
WMDE-Fisch moved this task from Doing to Tech Review on the WMDE-TechWish-Sprint-2022-01-19 board.

Change 756600 merged by jenkins-bot:

[mediawiki/extensions/FileImporter@master] Disable VE and 2017 wikitext editor on Edit File Info

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

Change 756599 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Allow disabling VE and 2017 wikitext editor from FileImporter

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

Thanks, @WMDE-Fisch! This looks like it should work correctly now.