Extension talk:CodeMirror

Jump to navigation Jump to search

About this board

Thanks for your feedback about the Extension:CodeMirror used to provide wikitext syntax highlight to pages on MediaWiki-based projects.

Report a new bug in Phabricator

Screenshot shows Codemirror without WikiEditor

4
Gunnar.offel (talkcontribs)

At the third screenshot it shows that the extension works with Wikieditor not active. Work this actually? Could you name me which Editor is used?

Thanks --Gunnar.offel (talk) 11:21, 1 November 2019 (UTC)

Jdforrester (WMF) (talkcontribs)

This was the old 2006 editor which was removed from MediaWiki a few years ago.

Jdforrester (WMF) (talkcontribs)

I've replaced the first image with an up-to-date version, but I don't know how to trigger the popup. @NKohli (WMF), do you remember how?

NKohli (WMF) (talkcontribs)

@Jdforrester (WMF) We did away with the popup when we took the feature out of beta because it'd have triggered a popup for every user. Thanks for updating the image.

Error in extension distributor

2
Valerio Bozzolan (talkcontribs)
Valerio Bozzolan (talkcontribs)

Well, now it works. I don't know why.

Alzi24 (talkcontribs)
MediaWiki 	1.31.1
PHP 	7.2.10-0ubuntu0.18.04.1 (apache2handler)
MySQL 	5.7.24-0ubuntu0.18.04.1-log
https://www.perrypedia.proc.org

We are using CodeMirror for a few weeks now and rate it very useful. There is an odd phenomenon which I don't know whether it is intended:

  • Activate CodeMirror, place the caret (mouse cursor for text input) anywhere.
  • Move the mouse, press "Ctrl" and left-click. Now there are two carets.
  • This may be repeated several times.
  • Now when typing text, it'll be inserted multiple times at all of the caret locations!

It is a little bit cumbersome because (esp. if one has clumsy fingers like me) this happens often when insertig text via Copy&Paste; the "Ctrl+V" is executed and the oversensitive touchpad detects an additional "Ctrl+click".

Is it a bug or a feature?

I'm working with Firefox 62-something but it is also reproducible with Opera and Chrome, even if not logged in.

Reply to "Multiple carets, bug or feature?"

Red dot

6
Summary by 197.218.94.223

https://phabricator.wikimedia.org/T181677

https://stackoverflow.com/a/19269811

Alzi24 (talkcontribs)

MW 1.31.1, Code Mirror 4.0.0 (a435d54) 22:01, 26. Apr. 2018

Sometimes there is a red dot beneath a category link. What does it mean?

NKohli (WMF) (talkcontribs)

I don't think CodeMirror has any feature which produces a red dot under category links. Although a screenshot would help.

Alzi24 (talkcontribs)

Editor with CodeMirror off:

CodeMirror activated:

At the moment, this is the first and only where it happens.

NKohli (WMF) (talkcontribs)

@Alzi24 Thanks for the screenshots! I tried to reproduce this with the same categories on a random page but I didn't see the dot. Can you give me a link to the page you are editing with? I tried figuring it out from the screenshots but searches on dewiki turned up nothing for Aracyclin. :)

197.218.94.223 (talkcontribs)

This is a deliberate feature of codemirror. It highlights some invisible characters..

Alzi24 (talkcontribs)

@NKohli (WMF): Our wiki URL is https://www.perrypedia.proc.org Don't know what dewiki is, our article pages usually appear high-ranked in most search engines, as long as they are no trivial terms out of the real life.

@IP: I have no idea how it could happen that someone inserted invisible characters. Anyway, you've answered my question and our simple solution is: remove characters, save page.

Thanks to all!

Reply to "Red dot"

Using browser search with CodeMirror

8
Alzi24 (talkcontribs)

Nice feature, works good for us. There seems to be a minor bug when Code Mirror is active. The browser search (Ctrl+F) sometimes finds the search text within the editor, sometimes it doesn't. Maybe it depends on how far one has scrolled forward within the editor. With code mirror off, the search result is reliably correct regardless if one has scrolled or not.

(MW 1.27.4. Firefox 57.0)

DannyH (WMF) (talkcontribs)

Hmm, that's a bug that I believe we fixed a little while ago... Let's see if we can reproduce the problem.

I'm on Firefox 57.0 too, and I did a successful browser search on a random page (en:Geologic time scale, looking for the word Putman).

Can you show me an example or two where you have the problem? Wiki, page and search term would help a lot.

Alzi24 (talkcontribs)

Example for the problem is:

https://www.perrypedia.proc.org/mediawiki/index.php?title=Die_Dritte_Macht_(Zyklus)&action=edit

CodeMirror on & Ctrl+F & search for "al-khor", which is at the very bottom of the page => nothing found.

CodeMirror off => search successful

Edits are restricted to registrated users only, so you'll first have to create an account https://www.perrypedia.proc.org/wiki/Spezial:Benutzerkonto_anlegen

But maybe that is not necessary, maybe the bug has been fixed in a later version? We use MW 1.27.4 and what I get through the ExtensionDistributer is CodeMirror 3.4.0, wheras the current version is 4.something.

DannyH (WMF) (talkcontribs)

Yes, that must be it. Good, I was worried that the bug fix had been reverted somehow. :)

@NKohli (WMF) or @MaxSem (WMF), could you help this user update to a later version of CodeMirror?

NKohli (WMF) (talkcontribs)

Hi @Alzi24 you can either upgrade your MW to a higher version or you can choose to get the 'master' version of CodeMirror from ExtensionDistributor. We cannot guarantee that it won't break anything but you can revert back to 3.4.0 if it does. Hope this helps.

Pastakhov (talkcontribs)

there is a patch that breaks compatibility with older Extension:WikiEditor, I chosen one the 'master' version too and it worked fine for me, you may try to do the same.

Alzi24 (talkcontribs)

Not our day today.

I will rather not upgrade to a higher (but no-LTS) MW. So I tried the newer versions of CodeMirror to inject in our MW 1.27.4:

- the version for 1.29 is still 3.4.0 with the reported problem

- the version for 1.30 & master is 4.0.0 but will not run under MW 1.27.4. The editor icon for activating the feature is missing. The reason seems to be a dependency by MobileFrontend, which calls a function CodeMirrorHooks::getGlobalVariables() that no longer exists in 4.0.0.

In a nutshell, it's all way to expensive for the original minor problem. As far as I know the next LTS Mediawiki will appear mid of next year, so that's the best time for the next MW upgrade.

Thanks anyway!

Alzi24 (talkcontribs)

MW upgraded to 1.31, plus new version of the extension installed -> works fine!

Reply to "Using browser search with CodeMirror"

CodeMirror in collaboration with WikiEditor, MW 1.31

4
Summary by Alzi24

User's mistake

Alzi24 (talkcontribs)

Hello there! I have just upgraded our test wiki to Mediawiki 1.31.

In our previous MW version, the CodeMirror extension (3.4.something) broke the browser search Ctrl+F, which should have been solved in the newer extension (4.0.0)

Unfortunately now with MW 1.31 the extension does not work at all. Seems as if there are problems with the WikiEditor (0.5.1), if the CodeMirror extension is installed.

There should be an additional icon in the WikiEditor's toolbar to switch the code highlighting on or off, but there isn't. Worse: If I set the user preference for the extended toolbar, then in the WikiEditor the toolbar disappars at all. And worst: As soon as the CodeMirror extension is installed, I earn an additional malfunction within the user preferences; it refuses switching to another tab: the browser URL tells me e.g. Spezial:Einstellungen#mw-prefsection-rc but the preferance still sticks on the first tab.

Does anyone have any ideas what I am doing wrong here?

NKohli (WMF) (talkcontribs)
Alzi24 (talkcontribs)

I have to apologize, I've made a mistake yesterday. Don't know what I did wrong. Today I removed the extension and reinstalled it from the ExtensionDistributor (which I thought was the same procedure I performed yesterday). It is still version 4.0.0 but now everything works fine.

For your interest: the master version results in

 PHP Fatal error:  Uncaught ExtensionDependencyError: CodeMirror is not compatible with the current MediaWiki core (version 1.31.1), it requires: >= 1.32.0. 

which seems reasonable ;-)

Sorry for stealing your time!

NKohli (WMF) (talkcontribs)

Oops, sorry about that. :)

AEzell (WMF) (talkcontribs)

Recently, Marijn and Adrian, the developers and maintainers of CodeMirror posted an explanation of the big changes they have in-store for Version 6 of CodeMirror: https://codemirror.net/6/

I work with the Community Tech team which helped integrate CodeMirror with the wikitext editor. Given this new version, we want to do two things.

First, we want to voice our support for Marijn and Adrian in their efforts. CodeMirror and the syntax highlighting it provides via this extension are a valuable feature for MW users.

Second, I'd like to gather some feedback on the current extension's strengths and what it lacks. If we take on the work to integrate this new version, we want to be sure to keep things that users like now and possibly fix or add features that users want. Marijn and Adrian are building CodeMirror with their own feature set in mind. We cannot and would not try to dictate feature requests or bug fixes. In the interest of collaboration, we do want to collect as much user feedback as we can so we can all have a better library and extension.

Our hope is that the new version will enable much easier integration which will create fewer bugs with the extension. Your input here can go a long way to making that true. It's important to point out that this is a preliminary discussion as the timeline for a finished library and my team's ability to start working with it is currently unknown.

Reply to "Revamp of CodeMirror"

How to check if switched on and access its API

1
V111P (talkcontribs)

For some reason the page Extension:CodeMirror does not explain these simple questions. If the API is not accessible in MediaWiki this should obviously be documented on the extension's page.

P.S. thanks to a comment by User:Trustable in another thread I figured out that you can check if CodeMirror is switched on with: $('.mw-editbutton-codemirror-active').length > 0 and you can swith it on/off with: $('#mw-editbutton-codemirror').click()

Reply to "How to check if switched on and access its API"
George Ho (talkcontribs)

Some (if not most) of us know that the extension is not compatible at Internet Explorer and lesser-known browsers. The "Browser support" section should be updated to reflect that. What about other parts of the page?

Reply to "Page should be updated"
Delusion23 (talkcontribs)

en:User talk:GregU/dashes.js is a useful script on English Wikipedia for turning hyhens into dashes. It appears it is no longer works when I use "Wikitext syntax highlighting" beta.

NKohli (WMF) (talkcontribs)

@Delusion23 Thanks for letting us know. There are several similar user scripts which break with CodeMirror. It seems like the script author isn't active on wiki anymore, unfortunately. We'll try to take a look at it.

Perhelion (talkcontribs)

CodeMirror breaks any script wich need manipulating plain Wiki text. To need fix every script except of CodeMirror is an absolute no-go. Why need CodeMirror a new Textbox? Other older (sometimes better) Syntax-highlighter have not this problem (my favorite is de:User:Schnark/js/syntaxhighlight).

PS: There is a difference in the textbox access .

$( '#wpTextbox1' ).val() is different to $( '#wpTextbox1' )[0].value

Which is normally fully the same, but seems a use of hook or something.

Reply to "User talk:GregU/dashes.js"