Page MenuHomePhabricator

CodeMirror forces loading of ext.wikiEditor module even when it isn't needed
Closed, ResolvedPublic5 Estimated Story Points

Description

There is code in CodeMirrorHooks::onResourceLoaderRegisterModules() that loads the ext.wikiEditor module from the WikiEditor extension if it is available. This module is only actually needed if the user has enabled the "enhanced editing toolbar" in their prefs (i.e. the "usebetatoolbar" user option). If they aren't using the enhanced toolbar, it shouldn't load the module, otherwise you get weird problems like a double border on the editing area.

Unfortunately, you can't successfully call $wgUser->getOption() from CodeMirrorHooks::onResourceLoaderRegisterModules(). You also can't call WikiEditorHooks::isEnabled( 'toolbar' ) since it uses $wgUser->getOption(). A more clever solution is needed.

Event Timeline

kaldari triaged this task as Medium priority.Apr 4 2017, 11:25 PM
kaldari set the point value for this task to 5.
kaldari moved this task from Needs Discussion to Up Next on the Community-Tech board.

Hi @Pastakhov, could you shed some light on why WikiEditor is a dependency for CodeMirror? What does WikiEditor do specifically, that CodeMirror needs to run after it?

Hi @Niharika, I have not looked at it yet. Seems it is a bug. I'll try to resolve it...

Change 348677 had a related patch set uploaded (by Pastakhov):
[mediawiki/extensions/CodeMirror@master] Remove some outdated code

https://gerrit.wikimedia.org/r/348677

kaldari moved this task from Ready to Q1 2018-19 on the Community-Tech-Sprint board.

Change 348677 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Remove some outdated code

https://gerrit.wikimedia.org/r/348677