Page MenuHomePhabricator

Insertion of special character at the wrong place
Open, Needs TriagePublic

Description

On French Wikisource, when Syntax Highlighting is enable, clicking on the toolbar for insertion of a special character at cursor's position does not work:

expected: insertion at current position of the cursor
behavior : the special character is added in the beginning of the edit box

On English Wikisource, in the same situation, when clicking on a custom toolbar for special character, the same error can be reproduced.

expected: insertion at current position of the cursor
behavior : the special character is added in the beginning of the edit box

Event Timeline

Aklapper changed the task status from Open to Stalled.Jun 5 2021, 4:39 PM

Hi @Assassas77, thanks for taking the time to report this! Unfortunately this Wikimedia Phabricator task lacks some information.
If you have time and can still reproduce the situation: Please add a more complete description to this task. That should be

  • a clear and complete list of exact steps to reproduce the situation, step by step, so that nobody needs to guess or interpret how you performed each step,
  • what happens after performing these steps to reproduce,
  • what you expected to happen instead,
  • a full link to a web address where the issue can be seen,
  • the web browser(s) and web browser version(s) that you tested.

You can edit the task description by clicking Edit Task. Ideally, a good description should allow any other person to follow these steps (without having to interpret steps) and see the same results. Problems that others can reproduce can get fixed faster. Thanks again!

Soda subscribed.

Was able to reproduce (a part of this bug)

Steps:

The problem seems to be that CodeMirror's textSelection API never seems to get registered (if ProofreadPage is loaded first) and fails with the following error:

Error: Another textSelection API was already registered
    at jQuery.fn.init.$.fn.textSelection (<anonymous>:668:928)
    at <anonymous>:166:86
    at fire (load.php?lang=en&modules=ext.CodeMirror.lib|jquery%2Coojs-ui-core%2Coojs-ui-widgets|jquery.ui&skin=vector&version=1fvf4:306)
    at Object.fireWith [as resolveWith] (load.php?lang=en&modules=ext.CodeMirror.lib|jquery%2Coojs-ui-core%2Coojs-ui-widgets|jquery.ui&skin=vector&version=1fvf4:308)
    at Object.deferred.<computed> [as resolve] (load.php?lang=en&modules=ext.CodeMirror.lib|jquery%2Coojs-ui-core%2Coojs-ui-widgets|jquery.ui&skin=vector&version=1fvf4:311)
    at Object.ready (<anonymous>:676:947)
    at doPropagation (load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector:6)

What we need is something like:

  • Check if CodeMirror is supposed to load
  • If it going to be loaded, wait for it to load
  • Unregister CodeMirror's textSelection API
  • Register our own API based on CodeMirror
Aklapper changed the task status from Stalled to Open.Jun 6 2021, 1:48 AM
MusikAnimal subscribed.

I was not able to reproduce this going by steps at T284370#7136225. I'm using the latest Firefox on Ubuntu. I tried with CodeMirror already enabled on page load and also switching it on/off. Perhaps there's a race condition I'm unable to meet.

What we need is something like:

  • Check if CodeMirror is supposed to load
  • If it going to be loaded, wait for it to load
  • Unregister CodeMirror's textSelection API
  • Register our own API based on CodeMirror

You'll probably want to make use of the ext.CodeMirror.switch hook to do this.

At any rate, this doesn't sound like an issue with CodeMirror itself, right? I am going to remove that tag, but please re-add if I'm wrong :)