Topic on Extension talk:CodeMirror

Problem when copy/paste from external text editors

8
Summary by NKohli (WMF)

Resolved

Herr Klugbeisser (talkcontribs)

Hello, I consistently face a problem when I do the following:

  • I make big edits or write new articles in a text editor outside the web browser (mostly because I write when I am offline)
  • When I copy/paste the text into the edit window, then
    • no syntax is highlighted
    • after using the "preview" function, the original text is previsualized and the text in the edit window is reset (and thereby lost)

This is a new phenomenon that arrived together with syntax highlighting. It happens consistently in Win7 and Internet Explorer. I used to see a similar phenomenon in Linux and Firefox, but not consistently.

See below for your reference:

NKohli (WMF) (talkcontribs)

I don't see the syntax highlighting icon in the toolbar in your images. Which editor are you using?

As long as you are not using syntax highlighting, you should not be affected by it at all. The way you describe your problem, it does not seem like it is being caused by syntax highlighting.

Herr Klugbeisser (talkcontribs)

Hello, I also don't see any syntax highlighting icon, but syntax highlighting has been activated for me some weeks ago. At least syntax is highlighted when I open the source of an article.

I am not aware of having any choice of editor. I assume I use the default editor in the German wikipedia. I have noticed that syntax highlighting is "off" for my user in the English wikipedia, but "on" in the German. I can't see any difference in the preferences. Emptying *.js and *.css subpages has not helped, switching between skins also not.

Please understand that I'm here for writing good articles and not for messing around with this kind of issues. --Herr Klugbeisser (talk) 09:03, 30 July 2018 (UTC)

NKohli (WMF) (talkcontribs)

@Herr Klugbeisser the content in your screenshots above does not appear to have syntax highlighting. What makes you think syntax highlighting is causing these issues for you?

Herr Klugbeisser (talkcontribs)

Hello,

I let you see what I see:

When I open any article in the German Wikipedia under Win7/IE, I see the above picture.

Syntax highlighting is obviously active. There is no icon, I don't know why. I have deleted my *css and *js yesterday, maybe this is the reason; it is opaque for the average user. Anyway, the icons were completely useless to me so I'm happy they are gone.

Now, assume I scroll down in the text and I want to edit the line where the cursor is.

If I click on the word "Eisenbahn" in the textbox, then

  • the text displayed "jumps" to the beginning
  • the scroll bar of the text box remains where the cursor is
  • the user has to look for the cursor

Marking a text is practically impossible because at clicking, the focus is lost and the user does not see the text he wanted to mark any more.

This is extremely annoying (I read several complaints in discussions of the German wikipedia). I have not experienced this before syntax highlighting was introduced. If you are sure that syntax highlighting is not the cause of this issue, please channel this bug to the right place inside Wikimedia.

Given this bug, the only way to work efficiently for me is to copy the whole text into an external editor, carry out my edits, then copy the complete text back to the editing window.

However, when I copy such a text back from any text editor (I have tried several), syntax highlighting fails to highlight (no loss), but also saving or previewing fails to show the text pasted from the external editor but instead visualises the original text.

This means that at the moment, I can't contribute under Windows.

I don't know how many people experience this issue.

The implementation of syntax highlighting was very poorly communicated, it took me some time to find out the probable cause of these issues even though I consider myself a regular contributor.

For some reason, in English Wikipedia syntax highlighting seems to be "off" for me even though my user settings are identical.


Under Linux (Mint 19/Firefox), syntax highlighting is also obviously active. No icon, however.

Editing works fine.

Pasting text from a text editor (kate in my case) usually works, but I have observed the issue described above occasionally.

NKohli (WMF) (talkcontribs)

@Herr Klugbeisser Do you have the toolbar disabled? I would suggest you enable the toolbar and then in the toolbar click the icon which will turn off syntax highlighting. After that you can disable the toolbar again and you will have no problems with syntax highlighting any more.

Herr Klugbeisser (talkcontribs)

Hello NKohli, it seems that I have found the reason: the CodeMirror conflicts with other "Helpers", in my case this one:

https://de.wikipedia.org/wiki/Benutzer_Diskussion:TMg/autoFormatter#Nonfunctional_in_CodeMirror_and_Visual_Editor_wikitext_mode

After removing this helper from my subpages, and activating/deactivating the standard toolbar, it seems that everything works.

I mistook the toolbar from the above "helper" for the standard mediawiki toolbar, hence the confusion.

Sorry for this. This point can be closed.

NKohli (WMF) (talkcontribs)

I am glad it got resolved for you.