diff --git a/extension.json b/extension.json index 1d983bdd..7ffa8a61 100644 --- a/extension.json +++ b/extension.json @@ -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": { diff --git a/includes/SyntaxHighlight.php b/includes/SyntaxHighlight.php index a597f9e6..f713b700 100644 --- a/includes/SyntaxHighlight.php +++ b/includes/SyntaxHighlight.php @@ -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' ], - ] ); - } }