⚓ T190108 Ways to opt-in/opt-out CodeMirror in 2003 Wikitext editor (without using the Toolbar)
Page MenuHomePhabricator

Ways to opt-in/opt-out CodeMirror in 2003 Wikitext editor (without using the Toolbar)
Closed, ResolvedPublic

Description

I made a comment at T101246#4062458, from which I can quote (but made tweaks).

The feature works at the 2003 wikitext editor (the one without the javascript-coded toolbars filled with buttons as seen in later WikiEditors). I just have to:

  1. Enable the Toolbar in Preference settings
  2. Enable the "Syntax Highlighting" feature in the Beta Preference
  3. Click the syntax highlighting button in the Toolbar
  4. Disable the Toolbar without disabling the feature

I originally discussed this at https://meta.wikimedia.org/wiki/Talk:Community_Tech/Wikitext_editor_syntax_highlighting#Not_working_in_2003_WikiEditor_and_whether_to_enable_or_disable_by_default . How do you allow directly enabling or disabling the feature in the 2003 WikiEditor without needing to enable the Toolbar to click on the "Highlighter" icon button? If Remember the dot's Syntax highlighter feature can be directly opt-in/opt-out without a Toolbar, why not this other feature?

Acceptance criteria

With CodeMirror 6 enabled:

  • The previously hidden preference for syntax highlighting should be surfaced at Special:Preferences under "Editing", in a new section called "Syntax highlighting".
    • This is the same preference as the toggle button in WikiEditor. So if you disable CodeMirror in WikIEditor, the preference should also appear disabled in Special:Preferences.
  • The preexisting "Enable colorblind-friendly scheme…" preference should now be under "Syntax highlighting" too, instead of under "Accessibility"
  • With the preference enabled and "Enable the editing toolbar" disabled, CodeMirror should work where it normally would with WikiEditor (editing pages, read-only pages)

With CodeMirror 6 disabled:

  • No syntax highlighting should be possible unless WikiEditor ("Enable the editing toolbar") is also enabled.
  • The preferences should appear as they do now in production, with the "Accessibility" section and the single "Enable colorblind-friendly scheme…" preference.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
gh87 updated the task description. (Show Details)
gh87 renamed this task from Enabling/Disabling the newer syntax highlighter feature without the Toolbox in 2003/Default WikiEditor to Enabling/Disabling CodeMirror mode without the Toolbox in 2003/Default WikiEditor.Apr 10 2018, 10:04 PM
gh87 renamed this task from Enabling/Disabling CodeMirror mode without the Toolbox in 2003/Default WikiEditor to Enable CodeMirror in 2003 Wikitext editor (without using the Toolbar).Apr 19 2018, 8:56 AM

CodeMirror should NOT be enabled by default. The color soup makes it very hard to read for some users. Let people enable it themselves, that makes it more understandable how it can be turned off.

See for example m:Talk:Community Tech/Wikitext editor syntax highlighting#the current color scheme is hard to read (which renders highlighting useless)

gh87 renamed this task from Enable CodeMirror in 2003 Wikitext editor (without using the Toolbar) to Ways to opt-in/opt-out CodeMirror in 2003 Wikitext editor (without using the Toolbar).May 3 2018, 12:17 AM

@jeblad I hate to admit that "Enable" is confusing and somewhat misleading, but I didn't wrote this task for the same purpose you opposed. Rather this is for finding ways to have the mode opted-in or opted-out in 2003 editor without using a toolbar. I changed the title and the description to reduce confusion.

Bhsd subscribed.

Possibly share a solution with T301615 to some extent.

I suppose I'll explore a toggle component for standalone CodeMirror (where WikiEditor isn't used). I'm thinking maybe a floating toggle, that appears only when you hover over the CodeMirror view. Or a tiny button pinned to the top-right, or something. If anyone has ideas, please share :)

What about top left? We used to have that for over a decade: https://www.mediawiki.org/wiki/Editor#Former

Well I was thinking more of a "floating" button, not a toolbar. We can discuss further at T190108.

A floating button is less discoverable, especially on touchscreens – unless it’s always visible, but then it hides something. Wikitext tends to have long lines, so it’s not unlikely that the first line runs to the right margin, and thus under the floating button at the top right. A fixed toolbar doesn’t take up that much screen real estate, and works universally.

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

[mediawiki/extensions/CodeMirror@master] CM6: move more Extensions to CodeMirror so they don't require WikiEditor

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

Change 1010319 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CM6: move more Extensions to CodeMirror so they don't require WikiEditor

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

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

[mediawiki/extensions/CodeMirror@master] CM6: Add syntax highlighting preference for users without WikiEditor

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

r1014614 adds a new section in the Editing preferences – "Syntax highlighting" – which contains "Enable syntax highlighting for wikitext" (the same preference used by WikiEditor, usecodemirror), and the existing but reworded "Use colorblind-friendly scheme" (usecodemirror-colorblind). So when $wgCodeMirrorV6 is true, we have a "Syntax highlighting" section, otherwise it shows the existing "Accessibility" section with the single usecodemirror-colorblind preference.

At T359498 it was noted the upcoming preferences for other features should perhaps have a place in Special:Preferences, too (namely so that Global Preferences can be used). It's undecided if we'll do that, but if we, we at least have a nice "Syntax highlighting" section to put them under :)

Note that this is not part of the CodeMirror 6 upgrade project (T259059), so it may take time to get code review and for this to progress.

Change #1014614 merged by jenkins-bot:

[mediawiki/extensions/CodeMirror@master] CM6: Add syntax highlighting preference for users without WikiEditor

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

dom_walden subscribed.

The behaviour appears consistent with acceptance criteria.

Testing on beta and locally.