Set default for 'usecodemirror' preference

This preferably would be set to on by default so that the extension
works out of the box, but it causes tests to fail in Core (T286623).

Despite the previous state of CodeMirrorHooks::onGetPreferences(),
CodeMirror was never on by default anyway.

Bug: T286270
Change-Id: Ic702b868b55aaa8ab71ddedd289c25f36b34b112
This commit is contained in:
MusikAnimal 2021-07-07 20:57:49 -04:00
parent daeaae012c
commit f7ef01b412
2 changed files with 5 additions and 3 deletions

View file

@ -165,6 +165,9 @@
"localBasePath": "resources", "localBasePath": "resources",
"remoteExtPath": "CodeMirror/resources" "remoteExtPath": "CodeMirror/resources"
}, },
"DefaultUserOptions": {
"usecodemirror": 0
},
"QUnitTestModule": { "QUnitTestModule": {
"localBasePath": "", "localBasePath": "",
"remoteExtPath": "CodeMirror", "remoteExtPath": "CodeMirror",

View file

@ -76,11 +76,10 @@ class CodeMirrorHooks {
* @param array &$defaultPreferences * @param array &$defaultPreferences
*/ */
public static function onGetPreferences( User $user, array &$defaultPreferences ) { public static function onGetPreferences( User $user, array &$defaultPreferences ) {
// CodeMirror is enabled by default for users. It can // CodeMirror is disabled by default for all users. It can enabled for everyone
// be changed by adding '$wgDefaultUserOptions['usecodemirror'] = 0;' into LocalSettings.php // by default by adding '$wgDefaultUserOptions['usecodemirror'] = 1;' into LocalSettings.php
$defaultPreferences['usecodemirror'] = [ $defaultPreferences['usecodemirror'] = [
'type' => 'api', 'type' => 'api',
'default' => '1',
]; ];
} }