Page MenuHomePhabricator

CodeMirror extension In Russian Wikisource breaks the edit field of pages
Open, Needs TriagePublic

Assigned To
None
Authored By
Vladis13
Sep 8 2018, 11:03 PM
Referenced Files
F25760340: compressed edit field.jpeg
Sep 11 2018, 1:19 AM
F25760344: openneweditpage.jpeg
Sep 11 2018, 1:19 AM
F25760345: no highlighing.jpeg
Sep 11 2018, 1:19 AM
F25760341: newfield.jpeg
Sep 11 2018, 1:19 AM
F25760347: dont work sh.jpeg
Sep 11 2018, 1:19 AM
F25760294: обычная.jpeg
Sep 11 2018, 1:19 AM
F25760343: after2ndpress.jpeg
Sep 11 2018, 1:19 AM
F25760342: after1stpress.jpeg
Sep 11 2018, 1:19 AM

Description

The CodeMirror extention In Russian Wikisource break the edit field of pages.
This enabled by button "syntax highlighting" of new edit toolbar. (The new edit panel globally replaced the previous one about 1-2 months ago, as I remember. There were no notes about it. Therefore, it was very shocking, after accidentally pressing a button, to encounter massive errors on all pages of the Wikisource. I think this extension should be packed as a gadget or beta-feature, like all similar ones.)

In namespace Page the edit field of proofreading pages is broken.
To example, this normal page.

обычная.jpeg (779×1 px, 212 KB)

After 1st pressing of the button the size of fonts are reduced to about half. In console has red error.
after1stpress.jpeg (844×1 px, 265 KB)

After 2nd pressingoff/on the size of fonts are restoring. On button appears borders as 'pressed' (1st pressed was not-pressed?).

after2ndpress.jpeg (714×1 px, 224 KB)

If open a edit page after button is pressed. (open to edit, enable the button, close, open to edit.)
Then the edit field moved to top, and broken the layout of fields of scan image and colontituls.

openneweditpage.jpeg (748×1 px, 220 KB)

After several clicks on button appears additional the normal edit field below. But above remains large edit fields.

newfield.jpeg (748×1 px, 208 KB)

Disabling work other gadgets. As I understand, it because gadgets works with the edit field in certain div in html. But this extention creating other edit field and show it in browser.
There is the gadget 'deyatifikator' that hard important for Russian Wikisource. RuWS specific is that almost all texts there are published before 1917 year, they in old orphography. So, necessery normal work of the gadget for convert texts to modern orphograhy.
Also, necessary work of other gadgets, e.g. Wikificator.

Broken syntax highlighting
To example, in Main namespace a page https://ru.wikisource.org/w/index.php?title=%D0%A0%D0%A1%D0%9A%D0%94/Graecia&action=edit
There the text is no more than two pages in size, but dont work syntax highlighting.
What about normal for Wikisource pages with size 0.5Mb, and to 1.5Mb?

dont work sh.jpeg (588×1 px, 397 KB)

All highlighting disappeared. Just opened edit page, scroll to bottom (highlighting here work only for 1st half page), placed one any letter in text bottom. Scroll to up. - And no any highlighting.

no highlighing.jpeg (590×1 px, 344 KB)

The extension page says that it have no conflict with gadget "SyntaxHighlighter" (from user settings, on bottom list of Edit section). But if enable it, then begin other bugs.
Compressed edit field, no way to expand it.
Appears if enable in user settings this gadget, open a page to edit, then again press the tab "Edit" (rus. "Править"), and press the button on/off. This glitch is not stable.

compressed edit field.jpeg (410×1 px, 127 KB)

There are other glitch , they not stable. (Or maybe fixed yesteday, I dont now, the extention seems as a beta under developing.)
To example:
Perhaps, because conflict with mentioned gadget. So the edit page loading very long or freezes. And the browser tab overload 100% of CPU and make leaking memory.

Без названия (1).jpeg (107×1 px, 24 KB)

All edit text shows as underlined and strange colored.
Or all text colored strange blue color, if change only one letter of any word then color of all text changing, if after change other letter then all text color changed again to other color, and so on.
In other time, a page to edit there is no syntax highlighting, or only template on top edit text is colored.

Wanted:
Perhaps it is better to move this to a gadget, so that those who wish can have the ability to enable/disable?
Many user can't work with such color theme, or be beta-testers. Also, it is big problem for wiki-enginers, to each time, when users report about any wiki bugs of templates or gadgets, wasting time checking for whether this is a error of the extention or something other.

Reproduce and settings:
This bugs starts If just enable this button of edit toolbar. Have on all edit pages of ru-Wikisource. User settings are by defaults, all betafeatures disabled, user scripts disabled. Theme is Monobook or Vector. The bug have in Chrome/Chromium and Firefox.
Did not any changes scripts or Meta settings in our ru-Wikisource. I found this problem yesterday.
Appears if login to Wikisource, but not edititng as anonim. Perhaps this problem no in other interwikies, e.g. I did not found it in Suomi Wikisource, however no any gadgets there.

The topic on ru-forum, where the presence of glitches also confirmed by the bureaucrat.

Event Timeline

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

In the browser console is red error "Uncaught Error: Another textSelection API was already registered" with mention of the CodeMirror script.

Vladis13 renamed this task from In Wikisource the edit field of proofreading pages is broken. to In Wikisource the edit field of pages is broken..Sep 9 2018, 2:07 AM
Vladis13 updated the task description. (Show Details)
Aklapper changed the task status from Open to Stalled.Sep 9 2018, 7:39 AM

Please provide a list of steps to reproduce, step by step, that someone else could follow (including links to an example).
As you mention some "beta-gadget", what is it? Please provide required settings on https://ru.wikisource.org/wiki/Служебная:Настройки#mw-prefsection-betafeatures and https://ru.wikisource.org/wiki/Служебная:Настройки#mw-prefsection-gadgets to see the problem, so someone else could try to reproduce the situation.

See https://mediawiki.org/wiki/How_to_report_a_bug how to structure bug reports. Thanks!

As term "beta-gadget" I meant that it's obvious that this is some kind of gadget in beta condition. I did not mean it in https://ru.wikisource.org/wiki/Служебная:Настройки#mw-prefsection-betafeatures.
But then it is not clear, why the beta gadget is released into the main space, without test notifications, and is not packaged as a "gadget" or "betafeatures"?

You can toggle CodeMirror syntax highlighting using the highlighter icon on the toolbar above the edit field.

Is way to disable it via settings?
Now very hard to work. Each press of a button is like a merry-go-round of glitches, they are different each time. Or the button for turning off the highlighting does not work. Another time when press the text size is reduced by half.
When opening a page in the Page namespace and the button was enabled past time, the scan image is shown not on the right, but below the text, which is very inconvenient.
And if the browser will drop status the button?
The editor should always check whether a button is pressed on it or not?

As term "beta-gadget" I meant that it's obvious that this is some kind of gadget

@Vladis13: Gadgets are per-wiki settings and their code is on-wiki. If "obviously some kind of gadget" is enabled on your wiki or broken on your wiki then you need to contact admins on your wiki to fix the broken gadget code on your wiki.

Off-topic: When it comes to broken gadgets on your wiki,

Still needs a list of clear steps to reproduce the problem, including links. :( See T203897#4569643

@Vladis13: Gadgets are per-wiki settings and their code is on-wiki. If "obviously some kind of gadget" is enabled on your wiki or broken on your wiki then you need to contact admins on your wiki to fix the broken gadget code on your wiki.

Well, then it is not gadget. :) Thanks @JJMC89 for T203897#4570067, now we know that it is ext. CodeMirror on the button in new edit toolbar. This new edit panel globally replaced the previous one about 1-2 months ago.

Off-topic: When it comes to broken gadgets on your wiki,

We checked them, they dont any affect CodeMirror, and these are innocuous errors. Thank you, we will try fix them after.

Still needs a list of clear steps to reproduce the problem, including links. :( See T203897#4569643

If just enable this button then starts the bugs. Have on all edit pages of ru-Wikisource. User settings are by defaults, all betafeatures disabled, user scripts disabled. Bug have in Chrome/Chromium, Firefox.
I will try rewrite the bugreport.

Vladis13 renamed this task from In Wikisource the edit field of pages is broken. to The CodeMirror extention In Russian Wikisource break the edit field of pages..Sep 11 2018, 1:19 AM
Vladis13 updated the task description. (Show Details)
Aklapper changed the task status from Stalled to Open.Sep 11 2018, 1:25 PM

So

  1. the reduced font size is because of the 'font-family: monospace,monospace;' hack. .CodeMirror resets this to 'monospace'. This is a bug. I'll see about getting it fixed.
  2. "Then the edit field moved to top, and broken the layout of fields of scan image and colontituls". This is a race condition with the dynamically loaded proofread tools there is an issue about this somewhere
  3. "Disabling work other gadgets" Your gadgets need to implement the jQuery.textSelection api to read and modify the textarea, if you want them to keep in sync with other gadgets and syntaxhhighlight tools.
  4. "There the text is no more than two pages in size, but dont work syntax highlighting" that's because it is all ONE line. If you insert line breaks in some spots (before loading CodeMirror) then activate CodeMirror highlighting button, then it does work. This is not a bug, but a performance limit.
  5. "The extension page says that it have no conflict with gadget " gadgets are the responsibility of the local community. I would expect problems if you enable both and advice against doing so.
Aklapper renamed this task from The CodeMirror extention In Russian Wikisource break the edit field of pages. to CodeMirror extension In Russian Wikisource breaks the edit field of pages.Apr 14 2019, 12:37 AM

In the browser console is red error "Uncaught Error: Another textSelection API was already registered" with mention of the CodeMirror script.

I also get "Error: Another textSelection API was already registered" sometimes on https://en.wikisource.org/w/index.php?title=Page:Vol_6_History_of_Mexico_by_H_H_Bancroft.djvu/98&action=edit&debug=true . Output in the developer tools of Firefox 75:

JQMIGRATE: Migrate is installed with logging active, version 3.1.0 jquery.migrate.js:81:17
This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. index.php
JQMIGRATE: jQuery.fn.delegate() is deprecated jquery.migrate.js:114:12
DNT is on, logging disabled load.php:136:10
JQMIGRATE: jQuery.fn.bind() is deprecated jquery.migrate.js:114:12
Error: Another textSelection API was already registered jquery.textSelection.js:422:12
    textSelection jQuery
    enableCodeMirror https://en.wikisource.org/w/extensions/CodeMirror/resources/ext.CodeMirror.js?c72a5:136
    enqueue https://en.wikisource.org/w/load.php?debug=true&lang=en&modules=startup&only=scripts&raw=1&skin=vector:1300
    using jQuery
    enableCodeMirror https://en.wikisource.org/w/extensions/CodeMirror/resources/ext.CodeMirror.js?c72a5:96
    addCodeMirrorToWikiEditor https://en.wikisource.org/w/extensions/CodeMirror/resources/ext.CodeMirror.js?c72a5:250
    build https://en.wikisource.org/w/load.php?debug=true&lang=en&modules=ext.wikiEditor&skin=vector&version=1crvn:1578