Esanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/268875
Change subject: Move VE module to extension.json ...................................................................... Move VE module to extension.json Change-Id: Iab603e466493711a4ce2b92283d2bd61d982dba1 --- M extension.json M includes/Graph.hooks.php 2 files changed, 60 insertions(+), 86 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Graph refs/changes/75/268875/1 diff --git a/extension.json b/extension.json index 6271466..0958ee0 100644 --- a/extension.json +++ b/extension.json @@ -101,6 +101,63 @@ ], "messages": [ "ok" ], "targets": [ "desktop" ] + }, + "ext.graph.visualEditor": { + "scripts": [ + "modules/ve-graph/ve.ce.MWGraphNode.js", + "modules/ve-graph/ve.dm.MWGraphModel.js", + "modules/ve-graph/ve.dm.MWGraphNode.js", + "modules/ve-graph/ve.ui.MWGraphDialog.js", + "modules/ve-graph/ve.ui.MWGraphDialogTool.js", + "modules/ve-graph/widgets/ve.ui.RowWidget.js", + "modules/ve-graph/widgets/ve.ui.TableWidget.js" + ], + "styles": [ + "modules/ve-graph/ve.ce.MWGraphNode.css", + "modules/ve-graph/ve.ui.MWGraphIcons.css", + "modules/ve-graph/widgets/ve.ui.RowWidget.css", + "modules/ve-graph/widgets/ve.ui.TableWidget.css" + ], + "dependencies": [ + "ext.graph.data", + "ext.visualEditor.mwcore", + "ext.visualEditor.mwimage.core" + ], + "messages": [ + "graph-ve-dialog-button-tooltip", + "graph-ve-dialog-edit-field-graph-type", + "graph-ve-dialog-edit-field-raw-json", + "graph-ve-dialog-edit-height", + "graph-ve-dialog-edit-json-invalid", + "graph-ve-dialog-edit-padding-auto", + "graph-ve-dialog-edit-padding-fieldset", + "graph-ve-dialog-edit-padding-table-bottom", + "graph-ve-dialog-edit-padding-table-left", + "graph-ve-dialog-edit-padding-table-right", + "graph-ve-dialog-edit-padding-table-top", + "graph-ve-dialog-edit-padding-table-unit", + "graph-ve-dialog-edit-page-data", + "graph-ve-dialog-edit-page-general", + "graph-ve-dialog-edit-page-raw", + "graph-ve-dialog-edit-size-fieldset", + "graph-ve-dialog-edit-size-table-unit", + "graph-ve-dialog-edit-table-row-delete", + "graph-ve-dialog-edit-title", + "graph-ve-dialog-edit-type-area", + "graph-ve-dialog-edit-type-bar", + "graph-ve-dialog-edit-type-line", + "graph-ve-dialog-edit-type-unknown", + "graph-ve-dialog-edit-width", + "graph-ve-dialog-edit-unknown-graph-type-warning", + "graph-ve-empty-graph", + "graph-ve-no-spec", + "graph-ve-vega-error", + "graph-ve-vega-error-no-render" + ], + "targets": [ + "mobile", + "desktop" + ] } }, "ResourceFileModulePaths": { @@ -116,9 +173,6 @@ ], "ParserAfterParse": [ "Graph\\Singleton::onParserAfterParse" - ], - "ResourceLoaderRegisterModules": [ - "Graph\\Hooks::onResourceLoaderRegisterModules" ], "ResourceLoaderTestModules": [ "Graph\\Hooks::onResourceLoaderTestModules" diff --git a/includes/Graph.hooks.php b/includes/Graph.hooks.php index 65f968a..2fbea28 100644 --- a/includes/Graph.hooks.php +++ b/includes/Graph.hooks.php @@ -12,93 +12,12 @@ class Hooks { /** - * Conditionally register the ext.graph.VisualEditor module if VisualEditor - * has been loaded - * - * @param ResourceLoader $resourceLoader - * @return boolean true - */ - public static function onResourceLoaderRegisterModules( ResourceLoader &$resourceLoader ) { - $resourceModules = $resourceLoader->getConfig()->get( 'ResourceModules' ); - - $graphModuleTemplate = array( - 'localBasePath' => dirname( __DIR__ ), - 'remoteExtPath' => 'Graph' - ); - - $addModules = array( - 'ext.graph.visualEditor' => $graphModuleTemplate + array( - 'scripts' => array( - 'modules/ve-graph/ve.ce.MWGraphNode.js', - 'modules/ve-graph/ve.dm.MWGraphModel.js', - 'modules/ve-graph/ve.dm.MWGraphNode.js', - 'modules/ve-graph/ve.ui.MWGraphDialog.js', - 'modules/ve-graph/ve.ui.MWGraphDialogTool.js', - 'modules/ve-graph/widgets/ve.ui.RowWidget.js', - 'modules/ve-graph/widgets/ve.ui.TableWidget.js' - ), - 'styles' => array( - 'modules/ve-graph/ve.ce.MWGraphNode.css', - 'modules/ve-graph/ve.ui.MWGraphIcons.css', - 'modules/ve-graph/widgets/ve.ui.RowWidget.css', - 'modules/ve-graph/widgets/ve.ui.TableWidget.css' - ), - 'dependencies' => array( - 'ext.graph.data', - 'ext.visualEditor.mwcore', - 'ext.visualEditor.mwimage.core' - ), - 'messages' => array( - 'graph-ve-dialog-button-tooltip', - 'graph-ve-dialog-edit-field-graph-type', - 'graph-ve-dialog-edit-field-raw-json', - 'graph-ve-dialog-edit-height', - 'graph-ve-dialog-edit-json-invalid', - 'graph-ve-dialog-edit-padding-auto', - 'graph-ve-dialog-edit-padding-fieldset', - 'graph-ve-dialog-edit-padding-table-bottom', - 'graph-ve-dialog-edit-padding-table-left', - 'graph-ve-dialog-edit-padding-table-right', - 'graph-ve-dialog-edit-padding-table-top', - 'graph-ve-dialog-edit-padding-table-unit', - 'graph-ve-dialog-edit-page-data', - 'graph-ve-dialog-edit-page-general', - 'graph-ve-dialog-edit-page-raw', - 'graph-ve-dialog-edit-size-fieldset', - 'graph-ve-dialog-edit-size-table-unit', - 'graph-ve-dialog-edit-table-row-delete', - 'graph-ve-dialog-edit-title', - 'graph-ve-dialog-edit-type-area', - 'graph-ve-dialog-edit-type-bar', - 'graph-ve-dialog-edit-type-line', - 'graph-ve-dialog-edit-type-unknown', - 'graph-ve-dialog-edit-width', - 'graph-ve-dialog-edit-unknown-graph-type-warning', - 'graph-ve-empty-graph', - 'graph-ve-no-spec', - 'graph-ve-vega-error', - 'graph-ve-vega-error-no-render' - ), - 'targets' => array( - 'mobile', 'desktop' - ) - ) - ); - - if ( isset( $resourceModules[ 'ext.visualEditor.mwcore' ] ) || $resourceLoader->isModuleRegistered( 'ext.visualEditor.mwcore' ) ) { - $resourceLoader->register( $addModules ); - } - - return true; - } - - /** * Conditionally register the unit testing module for the ext.graph.visualEditor module * only if that module is loaded * * @param array $testModules The array of registered test modules * @param ResourceLoader $resourceLoader The reference to the resource loader - * @return true + * @return bool */ public static function onResourceLoaderTestModules( array &$testModules, ResourceLoader &$resourceLoader ) { $resourceModules = $resourceLoader->getConfig()->get( 'ResourceModules' ); @@ -110,7 +29,8 @@ ), 'dependencies' => array( 'ext.graph.visualEditor', - 'ext.graph.vega1' + 'ext.graph.vega1', + 'ext.visualEditor.test' ), 'localBasePath' => dirname( __DIR__ ), 'remoteExtPath' => 'Graph' -- To view, visit https://gerrit.wikimedia.org/r/268875 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iab603e466493711a4ce2b92283d2bd61d982dba1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Graph Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits