Merge ext.geshi.data and ext.geshi.visualeditor modules

Until and unless there is an explicit need (and intent to support)
a public interface to use this data elsewhere, there is no need
for it to be a separate module.

It can be its own class, but at the resource level this data should
be considered a JavaScript file. And we don't create separate modules
for each file. They are in the same module unless they should be
semantically loaded in unrelated page contexts.

The module registery is not a javascript class autoloader. There
is a global cost to adding more modules to this registry.

Change-Id: Ifeddef8cfe00b6c115734f92eceab251a0b75bdb
This commit is contained in:
Timo Tijhof 2015-06-25 00:34:11 +01:00 committed by Alex Monk
parent e880ae6694
commit 6ba411fe2f
2 changed files with 8 additions and 10 deletions

View file

@ -17,7 +17,7 @@
* http://www.gnu.org/copyleft/gpl.html * http://www.gnu.org/copyleft/gpl.html
*/ */
class ResourceLoaderGeSHiDataModule extends ResourceLoaderModule { class ResourceLoaderGeSHiVisualEditorModule extends ResourceLoaderFileModule {
protected $targets = array( 'desktop', 'mobile' ); protected $targets = array( 'desktop', 'mobile' );
@ -26,9 +26,10 @@ class ResourceLoaderGeSHiDataModule extends ResourceLoaderModule {
* @return string JavaScript code * @return string JavaScript code
*/ */
public function getScript( ResourceLoaderContext $context ) { public function getScript( ResourceLoaderContext $context ) {
return Xml::encodeJsCall( $scripts = parent::getScript( $context );
'mw.config.set',
array( return $scripts . Xml::encodeJsCall(
'mw.config.set', array(
'wgGeSHiSupportedLanguages', 'wgGeSHiSupportedLanguages',
$this->getLanguages() $this->getLanguages()
), ),

View file

@ -21,7 +21,7 @@
"AutoloadClasses": { "AutoloadClasses": {
"SyntaxHighlight_GeSHi": "SyntaxHighlight_GeSHi.class.php", "SyntaxHighlight_GeSHi": "SyntaxHighlight_GeSHi.class.php",
"GeSHi": "SyntaxHighlight_GeSHi.compat.php", "GeSHi": "SyntaxHighlight_GeSHi.compat.php",
"ResourceLoaderGeSHiDataModule": "ResourceLoaderGeSHiDataModule.php" "ResourceLoaderGeSHiVisualEditorModule": "ResourceLoaderGeSHiVisualEditorModule.php"
}, },
"ExtensionFunctions": [ "ExtensionFunctions": [
"SyntaxHighlight_GeSHi::onSetup" "SyntaxHighlight_GeSHi::onSetup"
@ -43,6 +43,7 @@
] ]
}, },
"ext.geshi.visualEditor": { "ext.geshi.visualEditor": {
"class": "ResourceLoaderGeSHiVisualEditorModule",
"scripts": [ "scripts": [
"VisualEditor/ve.dm.MWSyntaxHighlightNode.js", "VisualEditor/ve.dm.MWSyntaxHighlightNode.js",
"VisualEditor/ve.ce.MWSyntaxHighlightNode.js", "VisualEditor/ve.ce.MWSyntaxHighlightNode.js",
@ -53,8 +54,7 @@
"VisualEditor/ve.ui.MWSyntaxHighlightInspector.css" "VisualEditor/ve.ui.MWSyntaxHighlightInspector.css"
], ],
"dependencies": [ "dependencies": [
"ext.visualEditor.mwcore", "ext.visualEditor.mwcore"
"ext.geshi.data"
], ],
"messages": [ "messages": [
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code", "syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code",
@ -62,9 +62,6 @@
"syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title" "syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title"
], ],
"targets": [ "desktop", "mobile" ] "targets": [ "desktop", "mobile" ]
},
"ext.geshi.data": {
"class": "ResourceLoaderGeSHiDataModule"
} }
}, },
"Hooks": { "Hooks": {