Register VE module unconditionally

Change-Id: Ifccc0223c2b57c0de6f6c14355850213b090f8fb
This commit is contained in:
Ed Sanders 2021-01-03 00:25:21 +00:00
parent 583e3b3db8
commit 16af4f3c6b
2 changed files with 34 additions and 52 deletions

View file

@ -53,6 +53,40 @@
"scripts": [
"pygments.linenumbers.js"
]
},
"ext.geshi.visualEditor": {
"class": "ResourceLoaderSyntaxHighlightVisualEditorModule",
"scripts": [
"ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js",
"ve-syntaxhighlight/ve.dm.MWBlockSyntaxHighlightNode.js",
"ve-syntaxhighlight/ve.dm.MWInlineSyntaxHighlightNode.js",
"ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js",
"ve-syntaxhighlight/ve.ce.MWBlockSyntaxHighlightNode.js",
"ve-syntaxhighlight/ve.ce.MWInlineSyntaxHighlightNode.js",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js"
],
"styles": [
"ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css",
"ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css"
],
"dependencies": [
"ext.visualEditor.mwcore",
"oojs-ui.styles.icons-editing-advanced"
],
"messages": [
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code",
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language",
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none",
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines",
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-startingline",
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title"
],
"targets": [ "desktop", "mobile" ]
}
},
"Hooks": {
@ -64,9 +98,6 @@
],
"ApiFormatHighlight": [
"SyntaxHighlight::onApiFormatHighlight"
],
"ResourceLoaderRegisterModules": [
"SyntaxHighlight::onResourceLoaderRegisterModules"
]
},
"attributes": {

View file

@ -592,53 +592,4 @@ class SyntaxHighlight {
// Inform MediaWiki that we have parsed this page and it shouldn't mess with it.
return false;
}
/**
* Conditionally register resource loader modules that depends on the
* VisualEditor MediaWiki extension.
*
* @param ResourceLoader $resourceLoader
*/
public static function onResourceLoaderRegisterModules( $resourceLoader ) {
if ( !ExtensionRegistry::getInstance()->isLoaded( 'VisualEditor' ) ) {
return;
}
$resourceLoader->register( 'ext.geshi.visualEditor', [
'class' => ResourceLoaderSyntaxHighlightVisualEditorModule::class,
'localBasePath' => __DIR__ . '/../modules',
'remoteExtPath' => 'SyntaxHighlight_GeSHi/modules',
'scripts' => [
've-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js',
've-syntaxhighlight/ve.dm.MWBlockSyntaxHighlightNode.js',
've-syntaxhighlight/ve.dm.MWInlineSyntaxHighlightNode.js',
've-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js',
've-syntaxhighlight/ve.ce.MWBlockSyntaxHighlightNode.js',
've-syntaxhighlight/ve.ce.MWInlineSyntaxHighlightNode.js',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightWindow.js',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.js',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightDialogTool.js',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js',
],
'styles' => [
've-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightDialog.css',
've-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css',
],
'dependencies' => [
'ext.visualEditor.mwcore',
'oojs-ui.styles.icons-editing-advanced'
],
'messages' => [
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code',
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language',
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none',
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines',
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-startingline',
'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title',
],
'targets' => [ 'desktop', 'mobile' ],
] );
}
}