Page MenuHomePhabricator

Investigation: Hooks on preview don't work when activating syntax highlighting (in MediaWiki:Diacritice.js on ro.wikipedia.org)
Closed, ResolvedPublic3 Story Points

Description

Edit any page on the Romanian Wikipedia without having syntax highlighting enabled. Enable syntax highlighting and then paste any of the wrong Romanian diacritics: "Ş ş Ţ ţ". Preview or save the page: the characters are saved as they are, because the code that corrects them does not run.

To ensure the code is correct, repeat the steps above without enabling syntax highlighting and/or with syntax highlighting already enabled. In both cases, the diacritics are corrected to "Ș ș Ț ț", as they should. From what I can see the hook is always correctly set, but it gets dropped when enabling syntax highlighting.

Event Timeline

Strainu created this task.Sep 29 2017, 8:12 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 29 2017, 8:12 AM

@Strainu can you tell me more about the hook? Where's it running? In some extension?

Oh, sorry for the omission. It's a JS file: https://ro.wikipedia.org/wiki/MediaWiki:Diacritice.js . Specifically, the ones in saveNewDiacritics() (I've only tested the one for the edit form)

kaldari renamed this task from Hooks on preview don't work when activating syntax highlighting to Investigation: Hooks on preview don't work when activating syntax highlighting .Oct 3 2017, 11:04 PM
kaldari triaged this task as Normal priority.
kaldari set the point value for this task to 3.
kaldari moved this task from Untriaged to Estimated on the Community-Tech board.Oct 3 2017, 11:11 PM
Niharika lowered the priority of this task from Normal to Low.Nov 7 2017, 11:24 PM
TBolliger moved this task from Estimated to Archive on the Community-Tech board.Feb 14 2018, 12:58 AM
TheDJ added a subscriber: TheDJ.Nov 20 2018, 9:57 AM

This is a ro.wp problem. The script uses the value of the textbox instead of the value from jquery.textSelection API. The only way a script can know about the changes that other scripts and/or editors make, is by hooking into jquery.textSelection.

Strainu closed this task as Resolved.Nov 20 2018, 12:07 PM
Strainu claimed this task.

Thank you @TheDJ , changing to jquery.textSelection solves the issue.

@Strainu sorry it took so long to provide an answer. :/

Aklapper renamed this task from Investigation: Hooks on preview don't work when activating syntax highlighting to Investigation: Hooks on preview don't work when activating syntax highlighting (in MediaWiki:Diacritice.js on ro.wikipedia.org).Nov 20 2018, 12:45 PM