Page MenuHomePhabricator

Extension:CodeMirror incompatibility with, breaks Extension:LinkSuggest
Open, Needs TriagePublic

Description

MediaWiki-extensions-CodeMirror is incompatible with MediaWiki-extensions-LinkSuggest.

When using Extension:CodeMirror, Extension:LinkSuggest no longer works. Links are no longer suggested when typing by LinkSuggest.

Quote https://www.mediawiki.org/wiki/Topic:Vzqfsrcx68axpea9

LinkSuggest only works on a plain textarea, which CodeMirror is not using. task T95100 is the bug for implementing an autocompletion freature on CodeMirror

related:
This bug report is probably as per T95100#7666796 not a duplicate of feature request T95100.

Event Timeline

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

LinkSuggest should use the jquery.textSelection API. If it works on the textarea directly, it can and will and is expected to break icw. CodeMirror and any other customised editor, like wikiEditor 2017, and various other syntax highlighting scripts.

This is not a CodeMirror issue.

I'm trying to change LinkSuggest to the textSelection API, but this alone doesn't solve the problem of LinkSuggest not working with CodeMirror.

LinkSuggest binds to the keydown and keypress events on the textarea to trigger the suggestions. However, when CodeMirror is active, the special editor doesn't forward those events to the native textarea, which means LinkSuggest doesn't detect any key events. I'm not sure what the possible solution would be without adding logic explicitly for CodeMirror, which looks a bit ugly to me, although CodeMirror itself has code to detect the presence of wikEd.