mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +00:00
Hooks: restore respect of $wgCodeMirrorLineNumberingNamespaces in CM5
Restore the ResourceLoaderGetConfigVars hook which CodeMirror 5 still relies on when it checks $wgCodeMirrorLineNumberingNamespaces. In CM6, this is set in the config provided by DataScript.php. Partially reverts I67518c0968 Bug: T347211 Follow-Up: I67518c0968f64c79e290f57b4884d30a161212d3 Change-Id: Id34858da68f7e08d16f8d1312bbbd355ccf8d140
This commit is contained in:
parent
f91f08947c
commit
60013b1f1f
|
@ -280,7 +280,8 @@
|
|||
"Hooks": {
|
||||
"EditPage::showEditForm:initial": "main",
|
||||
"EditPage::showReadOnlyForm:initial": "main",
|
||||
"GetPreferences": "main"
|
||||
"GetPreferences": "main",
|
||||
"ResourceLoaderGetConfigVars": "main"
|
||||
},
|
||||
"HookHandlers": {
|
||||
"main": {
|
||||
|
|
|
@ -11,6 +11,7 @@ use MediaWiki\Hook\EditPage__showEditForm_initialHook;
|
|||
use MediaWiki\Hook\EditPage__showReadOnlyForm_initialHook;
|
||||
use MediaWiki\Output\OutputPage;
|
||||
use MediaWiki\Preferences\Hook\GetPreferencesHook;
|
||||
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
|
||||
use MediaWiki\User\Options\UserOptionsLookup;
|
||||
use MediaWiki\User\User;
|
||||
|
||||
|
@ -20,6 +21,7 @@ use MediaWiki\User\User;
|
|||
class Hooks implements
|
||||
EditPage__showEditForm_initialHook,
|
||||
EditPage__showReadOnlyForm_initialHook,
|
||||
ResourceLoaderGetConfigVarsHook,
|
||||
GetPreferencesHook
|
||||
{
|
||||
|
||||
|
@ -141,6 +143,20 @@ class Hooks implements
|
|||
return $this->useV6 || $out->getRequest()->getRawVal( 'cm6enable' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook handler for enabling bracket matching.
|
||||
*
|
||||
* TODO: Remove after migration to CodeMirror 6 is complete.
|
||||
*
|
||||
* @param array &$vars Array of variables to be added into the output of the startup module
|
||||
* @param string $skin
|
||||
* @param Config $config
|
||||
* @return void This hook must not abort, it must return no value
|
||||
*/
|
||||
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
|
||||
$vars['wgCodeMirrorLineNumberingNamespaces'] = $config->get( 'CodeMirrorLineNumberingNamespaces' );
|
||||
}
|
||||
|
||||
/**
|
||||
* GetPreferences hook handler
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue