mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-14 10:34:53 +00:00
Skip registering RL modules depending on VisualEditor
When VisualEditor is not installed, there is no point in registered resource loader modules that depends on it. A use case is trying to run tests for the MediaWiki tarball. It comes with Cite but without VisualEditor. The patch is based on GuidedTour patch by Matthew Flaschen https://gerrit.wikimedia.org/r/#/c/305691/ for T143297 Remove the message "cite-ve-othergroup-item" which got introduced in REL1_28 by724d890
and is not in REL1_27. Adjust base directory for REL1_27 since CiteHooks.php is at the root when REL1_28 had it moved under includes/Cite.hooks.php Change-Id: Idf769e0149f93c099a94b1b7a6cb203273dab881 (cherry picked from commit5fcecf9e5f
)
This commit is contained in:
parent
90128c2d78
commit
fc48a763e0
110
CiteHooks.php
110
CiteHooks.php
|
@ -66,6 +66,116 @@ class CiteHooks {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally register resource loader modules that depends on the
|
||||
* VisualEditor MediaWiki extension.
|
||||
*
|
||||
* @param $resourceLoader
|
||||
* @return true
|
||||
*/
|
||||
public static function onResourceLoaderRegisterModules( &$resourceLoader ) {
|
||||
|
||||
if ( ! class_exists( 'VisualEditorHooks' ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$dir = __DIR__ . DIRECTORY_SEPARATOR;
|
||||
|
||||
$resourceLoader->register( "ext.cite.visualEditor.core", [
|
||||
'localBasePath' => $dir . 'modules',
|
||||
'remoteExtPath' => 'Cite/modules',
|
||||
"scripts" => [
|
||||
"ve-cite/ve.dm.MWReferenceModel.js",
|
||||
"ve-cite/ve.dm.MWReferencesListNode.js",
|
||||
"ve-cite/ve.dm.MWReferenceNode.js",
|
||||
"ve-cite/ve.ce.MWReferencesListNode.js",
|
||||
"ve-cite/ve.ce.MWReferenceNode.js",
|
||||
"ve-cite/ve.ui.MWReferencesListCommand.js"
|
||||
],
|
||||
"styles" => [
|
||||
"ve-cite/ve.ce.MWReferencesListNode.css",
|
||||
"ve-cite/ve.ce.MWReferenceNode.css"
|
||||
],
|
||||
"dependencies" => [
|
||||
"ext.visualEditor.mwcore"
|
||||
],
|
||||
"messages" => [
|
||||
"cite-ve-referenceslist-isempty",
|
||||
"cite-ve-referenceslist-isempty-default",
|
||||
"cite-ve-referenceslist-missingref"
|
||||
],
|
||||
"targets" => [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
] );
|
||||
|
||||
$resourceLoader->register( "ext.cite.visualEditor.data",
|
||||
[ "class" => "CiteDataModule" ] );
|
||||
|
||||
$resourceLoader->register( "ext.cite.visualEditor", [
|
||||
'localBasePath' => $dir . 'modules',
|
||||
'remoteExtPath' => 'Cite/modules',
|
||||
"scripts" => [
|
||||
"ve-cite/ve.ui.MWReferenceGroupInputWidget.js",
|
||||
"ve-cite/ve.ui.MWReferenceSearchWidget.js",
|
||||
"ve-cite/ve.ui.MWReferenceResultWidget.js",
|
||||
"ve-cite/ve.ui.MWUseExistingReferenceCommand.js",
|
||||
"ve-cite/ve.ui.MWCitationDialog.js",
|
||||
"ve-cite/ve.ui.MWReferencesListDialog.js",
|
||||
"ve-cite/ve.ui.MWReferenceDialog.js",
|
||||
"ve-cite/ve.ui.MWReferenceDialogTool.js",
|
||||
"ve-cite/ve.ui.MWCitationDialogTool.js",
|
||||
"ve-cite/ve.ui.MWReferenceContextItem.js",
|
||||
"ve-cite/ve.ui.MWReferencesListContextItem.js",
|
||||
"ve-cite/ve.ui.MWCitationContextItem.js",
|
||||
"ve-cite/ve.ui.MWCitationAction.js",
|
||||
"ve-cite/ve.ui.MWReference.init.js"
|
||||
],
|
||||
"styles" => [
|
||||
"ve-cite/ve.ui.MWReferenceContextItem.css",
|
||||
"ve-cite/ve.ui.MWReferenceGroupInputWidget.css",
|
||||
"ve-cite/ve.ui.MWReferenceIcons.css",
|
||||
"ve-cite/ve.ui.MWReferenceResultWidget.css",
|
||||
"ve-cite/ve.ui.MWReferenceSearchWidget.css"
|
||||
],
|
||||
"dependencies" => [
|
||||
"ext.cite.visualEditor.core",
|
||||
"ext.cite.visualEditor.data",
|
||||
"ext.cite.style",
|
||||
"ext.visualEditor.mwtransclusion",
|
||||
"ext.visualEditor.mediawiki"
|
||||
],
|
||||
"messages" => [
|
||||
"cite-ve-dialog-reference-editing-reused",
|
||||
"cite-ve-dialog-reference-options-group-label",
|
||||
"cite-ve-dialog-reference-options-group-placeholder",
|
||||
"cite-ve-dialog-reference-options-name-label",
|
||||
"cite-ve-dialog-reference-options-section",
|
||||
"cite-ve-dialog-reference-title",
|
||||
"cite-ve-dialog-reference-useexisting-full-label",
|
||||
"cite-ve-dialog-reference-useexisting-label",
|
||||
"cite-ve-dialog-reference-useexisting-tool",
|
||||
"cite-ve-dialog-referenceslist-contextitem-description-general",
|
||||
"cite-ve-dialog-referenceslist-contextitem-description-named",
|
||||
"cite-ve-dialog-referenceslist-title",
|
||||
"cite-ve-dialogbutton-citation-educationpopup-title",
|
||||
"cite-ve-dialogbutton-citation-educationpopup-text",
|
||||
"cite-ve-dialogbutton-reference-full-label",
|
||||
"cite-ve-dialogbutton-reference-tooltip",
|
||||
"cite-ve-dialogbutton-reference-title",
|
||||
"cite-ve-dialogbutton-referenceslist-tooltip",
|
||||
"cite-ve-reference-input-placeholder",
|
||||
"cite-ve-toolbar-group-label"
|
||||
],
|
||||
"targets" => [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
] );
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for LinksUpdate hook
|
||||
* Post-output processing of references property, for proper db storage
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
"ResourceLoaderTestModules": [
|
||||
"CiteHooks::onResourceLoaderTestModules"
|
||||
],
|
||||
"ResourceLoaderRegisterModules": [
|
||||
"CiteHooks::onResourceLoaderRegisterModules"
|
||||
],
|
||||
"LinksUpdate": [
|
||||
"CiteHooks::onLinksUpdate"
|
||||
],
|
||||
|
@ -67,93 +70,6 @@
|
|||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.cite.visualEditor.core": {
|
||||
"scripts": [
|
||||
"ve-cite/ve.dm.MWReferenceModel.js",
|
||||
"ve-cite/ve.dm.MWReferencesListNode.js",
|
||||
"ve-cite/ve.dm.MWReferenceNode.js",
|
||||
"ve-cite/ve.ce.MWReferencesListNode.js",
|
||||
"ve-cite/ve.ce.MWReferenceNode.js",
|
||||
"ve-cite/ve.ui.MWReferencesListCommand.js"
|
||||
],
|
||||
"styles": [
|
||||
"ve-cite/ve.ce.MWReferencesListNode.css",
|
||||
"ve-cite/ve.ce.MWReferenceNode.css"
|
||||
],
|
||||
"dependencies": [
|
||||
"ext.visualEditor.mwcore"
|
||||
],
|
||||
"messages": [
|
||||
"cite-ve-referenceslist-isempty",
|
||||
"cite-ve-referenceslist-isempty-default",
|
||||
"cite-ve-referenceslist-missingref"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.cite.visualEditor.data": {
|
||||
"class": "CiteDataModule"
|
||||
},
|
||||
"ext.cite.visualEditor": {
|
||||
"scripts": [
|
||||
"ve-cite/ve.ui.MWReferenceGroupInputWidget.js",
|
||||
"ve-cite/ve.ui.MWReferenceSearchWidget.js",
|
||||
"ve-cite/ve.ui.MWReferenceResultWidget.js",
|
||||
"ve-cite/ve.ui.MWUseExistingReferenceCommand.js",
|
||||
"ve-cite/ve.ui.MWCitationDialog.js",
|
||||
"ve-cite/ve.ui.MWReferencesListDialog.js",
|
||||
"ve-cite/ve.ui.MWReferenceDialog.js",
|
||||
"ve-cite/ve.ui.MWReferenceDialogTool.js",
|
||||
"ve-cite/ve.ui.MWCitationDialogTool.js",
|
||||
"ve-cite/ve.ui.MWReferenceContextItem.js",
|
||||
"ve-cite/ve.ui.MWReferencesListContextItem.js",
|
||||
"ve-cite/ve.ui.MWCitationContextItem.js",
|
||||
"ve-cite/ve.ui.MWCitationAction.js",
|
||||
"ve-cite/ve.ui.MWReference.init.js"
|
||||
],
|
||||
"styles": [
|
||||
"ve-cite/ve.ui.MWReferenceContextItem.css",
|
||||
"ve-cite/ve.ui.MWReferenceGroupInputWidget.css",
|
||||
"ve-cite/ve.ui.MWReferenceIcons.css",
|
||||
"ve-cite/ve.ui.MWReferenceResultWidget.css",
|
||||
"ve-cite/ve.ui.MWReferenceSearchWidget.css"
|
||||
],
|
||||
"dependencies": [
|
||||
"ext.cite.visualEditor.core",
|
||||
"ext.cite.visualEditor.data",
|
||||
"ext.cite.style",
|
||||
"ext.visualEditor.mwtransclusion",
|
||||
"ext.visualEditor.mediawiki"
|
||||
],
|
||||
"messages": [
|
||||
"cite-ve-dialog-reference-editing-reused",
|
||||
"cite-ve-dialog-reference-options-group-label",
|
||||
"cite-ve-dialog-reference-options-group-placeholder",
|
||||
"cite-ve-dialog-reference-options-name-label",
|
||||
"cite-ve-dialog-reference-options-section",
|
||||
"cite-ve-dialog-reference-title",
|
||||
"cite-ve-dialog-reference-useexisting-full-label",
|
||||
"cite-ve-dialog-reference-useexisting-label",
|
||||
"cite-ve-dialog-reference-useexisting-tool",
|
||||
"cite-ve-dialog-referenceslist-contextitem-description-general",
|
||||
"cite-ve-dialog-referenceslist-contextitem-description-named",
|
||||
"cite-ve-dialog-referenceslist-title",
|
||||
"cite-ve-dialogbutton-citation-educationpopup-title",
|
||||
"cite-ve-dialogbutton-citation-educationpopup-text",
|
||||
"cite-ve-dialogbutton-reference-full-label",
|
||||
"cite-ve-dialogbutton-reference-tooltip",
|
||||
"cite-ve-dialogbutton-reference-title",
|
||||
"cite-ve-dialogbutton-referenceslist-tooltip",
|
||||
"cite-ve-reference-input-placeholder",
|
||||
"cite-ve-toolbar-group-label"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
}
|
||||
},
|
||||
"ResourceFileModulePaths": {
|
||||
|
|
Loading…
Reference in a new issue