Page MenuHomePhabricator

CodeMirror shouldn't load in the 2017 editor on RTL pages
Closed, ResolvedPublicBUG REPORT

Description

This applies to legacy CodeMirror 5, not T259059: Upgrade to CodeMirror 6.

Steps to replicate the issue (include links if applicable):

What happens?:

The "Syntax highlighting" option is available in the Page options, and if enabled, CodeMirror is loaded (i.e. <div> tags are highlighted)

What should have happened instead?:

CodeMirror should not be available because it is an RTL page.

Other information:

CodeMirror 6 (T259059) brings RTL support, but CM6 isn't available for the 2017 editor yet (T357482). Until then, CodeMirror + 2017 editor should not be possible on RTL pages due to glaring bugs (ref).

If I understand the extension attribute VisualEditorPluginModules will unconditionally load the ext.CodeMirror.visualEditor module, and this module does not check the direction of the content. It would seem this has been this case since... always (?)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1025449 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] ext.CodeMirror.visualEditor: don't load on RTL pages

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

Change #1025449 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] ext.CodeMirror.visualEditor: don't load on RTL pages

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

Change #1031069 had a related patch set uploaded (by Tim Starling; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@wmf/1.43.0-wmf.4] ext.CodeMirror.visualEditor: don't load on RTL pages

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

Change #1031069 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@wmf/1.43.0-wmf.4] ext.CodeMirror.visualEditor: don't load on RTL pages

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

Mentioned in SAL (#wikimedia-operations) [2024-05-14T00:20:37Z] <tstarling@deploy1002> Started scap: Fix SecurePoll exception T209892 and CodeMirror 5 RTL T363752

Mentioned in SAL (#wikimedia-operations) [2024-05-14T00:35:34Z] <tstarling@deploy1002> Finished scap: Fix SecurePoll exception T209892 and CodeMirror 5 RTL T363752 (duration: 14m 56s)

tstarling subscribed.

Confirmed fix on ar.wikipedia.org

Change #1037662 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CodeMirror@master] ext.CodeMirror.visualEditor: check language dir of html for new pages

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

Change #1037662 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] ext.CodeMirror.visualEditor: check language dir of html for new pages

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