Investigation: CodeMirror and WikEd gadget (and maybe other syntax highlighting gadgets) don't get along well
Closed, ResolvedPublic3 Story Points

Description

I tried enabling both of these and I experienced all sorts of problems. The worst problem is that sometimes it loses my edit completely when I save.

We should prevent these two tools from being able to load on the same page (as they both try to hijack the editing area). I'm not sure if it would be better to fix this on the CodeMirror side or the WikEd side (or both).

kaldari created this task.Oct 17 2017, 12:00 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 17 2017, 12:00 AM
kaldari renamed this task from CodeMirror and WikEd gadget don't get along well to Investigation: CodeMirror and WikEd gadget (and maybe other syntax highlighting gadgets) don't get along well.Oct 17 2017, 11:26 PM
kaldari triaged this task as High priority.
kaldari set the point value for this task to 3.
kaldari updated the task description. (Show Details)Oct 27 2017, 12:32 AM

Change 389645 had a related patch set uploaded (by Kaldari; owner: Kaldari):
[mediawiki/extensions/CodeMirror@master] Prevent loading CodeMirror if wikEd gadget is enabled

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

kaldari added a comment.EditedNov 6 2017, 11:30 PM

I went and ahead and did a stop-gap solution in the meantime (https://gerrit.wikimedia.org/r/389645), which should be live on Nov 9. Assuming it works, it should prevent CodeMirror's syntax highlighting from loading when the wikEd Gadget is enabled. This solution probably only works reliably for the WikiEditor extension editor (the default editor), since in that case it has to wait for a JS hook to fire before running the enableCodeMirror() function, by which time window.wikEd should be defined. With the old classic Wikitext editor there is probably still a possibility for a race condition. Either way, it would be nice to come up with a more fool-proof solution to this bug. Some info that might be useful: https://en.wikipedia.org/wiki/User:Cacycle/wikEd.

Change 389645 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Prevent loading CodeMirror if wikEd gadget is enabled

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

Niharika claimed this task.Nov 7 2017, 9:21 PM
Niharika moved this task from Ready to In Development on the Community-Tech-Sprint board.

I only use https://en.wikipedia.org/wiki/User:Cacycle/diff and this generates no problem with CodeMirror. The change https://gerrit.wikimedia.org/r/389645 is terrible. Since this change I can not enable the CodeMirror by clicking the button. But a click on the button still activates the CodeMirror in the user preferences. On the next reload the CodeMirror is often activated because the CodeMirror module loads faster than the wikEd diff.

I think I ran into the same thing as @Fomafix when trying to test out CodeMirror - I only have the diff part of wikEd, which shouldn't interfere with CodeMirror at all.

I only use https://en.wikipedia.org/wiki/User:Cacycle/diff and this generates no problem with CodeMirror. The change https://gerrit.wikimedia.org/r/389645 is terrible. Since this change I can not enable the CodeMirror by clicking the button. But a click on the button still activates the CodeMirror in the user preferences. On the next reload the CodeMirror is often activated because the CodeMirror module loads faster than the wikEd diff.

Well, that was the point of it but yes, I've heard similar complaints when users assumed CodeMirror was broken. I'll look into it.

Change 395529 had a related patch set uploaded (by Niharika29; owner: Niharika Kohli):
[mediawiki/extensions/CodeMirror@master] Don't break codemirror if wikEdDiff is enabled, only if wikEd is enabled

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

Change 395529 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Don't break codemirror if wikEdDiff is enabled, only if wikEd is enabled

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

kaldari closed this task as Resolved.Dec 5 2017, 11:14 PM

Niharika's patch should fix WikEdDiff. I'll create a separate bug for the button-still-functioning issue.