mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Make it possible to send VE cite toolbar items to the 'insert' (other) group
To be merged with Ifd688ae6 Bug: T133727 Change-Id: Ic87f996f2a95ffe89999384c48f11745f251db0e
This commit is contained in:
parent
e284811889
commit
724d890541
|
@ -135,4 +135,13 @@ class CiteHooks {
|
|||
// delete with reduced hold off period (LinksUpdate uses a master connection)
|
||||
$cache->delete( $key, WANObjectCache::MAX_COMMIT_DELAY );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds extra variables to the global config
|
||||
*/
|
||||
public static function onResourceLoaderGetConfigVars( array &$vars ) {
|
||||
$config = ConfigFactory::getDefaultInstance()->makeConfig( 'cite' );
|
||||
$vars['wgCiteVisualEditorOtherGroup'] = $config->get( 'CiteVisualEditorOtherGroup' );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
],
|
||||
"LinksUpdateComplete": [
|
||||
"CiteHooks::onLinksUpdateComplete"
|
||||
],
|
||||
"ResourceLoaderGetConfigVars": [
|
||||
"CiteHooks::onResourceLoaderGetConfigVars"
|
||||
]
|
||||
},
|
||||
"ResourceModules": {
|
||||
|
@ -148,7 +151,8 @@
|
|||
"cite-ve-dialogbutton-reference-title",
|
||||
"cite-ve-dialogbutton-referenceslist-tooltip",
|
||||
"cite-ve-reference-input-placeholder",
|
||||
"cite-ve-toolbar-group-label"
|
||||
"cite-ve-toolbar-group-label",
|
||||
"cite-ve-othergroup-item"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
|
@ -170,7 +174,8 @@
|
|||
"AllowCiteGroups": true,
|
||||
"CiteCacheReferences": false,
|
||||
"CiteStoreReferencesData": false,
|
||||
"CiteCacheReferencesDataOnParse": false
|
||||
"CiteCacheReferencesDataOnParse": false,
|
||||
"CiteVisualEditorOtherGroup": false
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"ApiQueryReferences": "ApiQueryReferences.php",
|
||||
|
|
|
@ -44,5 +44,6 @@
|
|||
"cite-ve-referenceslist-isempty": "There are no references with the group \"$1\" on this page to include in this list.",
|
||||
"cite-ve-referenceslist-isempty-default": "There are no references on this page to include in this list.",
|
||||
"cite-ve-referenceslist-missingref": "This reference is defined in a template or other generated block, and for now can only be edited in source mode.",
|
||||
"cite-ve-toolbar-group-label": "Cite"
|
||||
"cite-ve-toolbar-group-label": "Cite",
|
||||
"cite-ve-othergroup-item": "$1 reference"
|
||||
}
|
|
@ -54,5 +54,6 @@
|
|||
"cite-ve-referenceslist-isempty": "Message that appears in the references list when there are no references on the page of that group.\n\nParameters:\n* $1 - reference-group name",
|
||||
"cite-ve-referenceslist-isempty-default": "Message that appears in the references list when there are no references on the page in the default group.",
|
||||
"cite-ve-referenceslist-missingref": "Message that appears in the references list, and as a tooltip on the reference itself, for references that are generated by a template or are otherwise uneditable.\n\nSee also:\n* {{msg-mw|visualeditor-dialog-meta-languages-readonlynote}}",
|
||||
"cite-ve-toolbar-group-label": "Label text for the toolbar button for inserting customized references.\n{{Identical|Cite}}"
|
||||
"cite-ve-toolbar-group-label": "Label text for the toolbar button for inserting customized references.\n{{Identical|Cite}}",
|
||||
"cite-ve-othergroup-item": "Label text for the toolbar items under the 'Insert' (other) group if VisualEditor is configured that way.\n\nParameters:\n* $1 - citation type label"
|
||||
}
|
|
@ -12,6 +12,18 @@
|
|||
}
|
||||
toolGroups = target.static.toolbarGroups;
|
||||
linkIndex = toolGroups.length;
|
||||
|
||||
if ( mw.config.get( 'wgCiteVisualEditorOtherGroup' ) ) {
|
||||
for ( j = 0; j < linkIndex; j++ ) {
|
||||
if ( toolGroups[ j ].include === '*' ) {
|
||||
toolGroups[ j ].type = 'list';
|
||||
toolGroups[ j ].include = [ '*', { group: 'cite' }, 'reference', 'reference/existing' ];
|
||||
toolGroups[ j ].demote = [ 'reference', 'reference/existing' ];
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for ( j = 0, jLen = toolGroups.length; j < jLen; j++ ) {
|
||||
if ( ve.getProp( toolGroups[ j ], 'include', 0, 'group' ) === 'cite' ) {
|
||||
// Skip if the cite group exists already
|
||||
|
@ -99,7 +111,11 @@
|
|||
tool.static.group = 'cite';
|
||||
tool.static.name = name;
|
||||
tool.static.icon = item.icon;
|
||||
if ( mw.config.get( 'wgCiteVisualEditorOtherGroup' ) ) {
|
||||
tool.static.title = mw.msg( 'cite-ve-othergroup-item', item.title );
|
||||
} else {
|
||||
tool.static.title = item.title;
|
||||
}
|
||||
tool.static.commandName = name;
|
||||
tool.static.template = item.template;
|
||||
tool.static.autoAddToCatchall = false;
|
||||
|
|
|
@ -21,8 +21,16 @@ OO.inheritClass( ve.ui.MWReferenceDialogTool, ve.ui.FragmentWindowTool );
|
|||
ve.ui.MWReferenceDialogTool.static.name = 'reference';
|
||||
ve.ui.MWReferenceDialogTool.static.group = 'object';
|
||||
ve.ui.MWReferenceDialogTool.static.icon = 'reference';
|
||||
ve.ui.MWReferenceDialogTool.static.title =
|
||||
OO.ui.deferMsg( 'cite-ve-dialogbutton-reference-tooltip' );
|
||||
if ( mw.config.get( 'wgCiteVisualEditorOtherGroup' ) ) {
|
||||
ve.ui.MWReferenceDialogTool.static.title = OO.ui.deferMsg(
|
||||
'cite-ve-othergroup-item',
|
||||
OO.ui.msg( 'cite-ve-dialogbutton-reference-tooltip' )
|
||||
);
|
||||
} else {
|
||||
ve.ui.MWReferenceDialogTool.static.title = OO.ui.deferMsg(
|
||||
'cite-ve-dialogbutton-reference-tooltip'
|
||||
);
|
||||
}
|
||||
ve.ui.MWReferenceDialogTool.static.modelClasses = [ ve.dm.MWReferenceNode ];
|
||||
ve.ui.MWReferenceDialogTool.static.commandName = 'reference';
|
||||
ve.ui.MWReferenceDialogTool.static.autoAddToCatchall = false;
|
||||
|
@ -44,8 +52,16 @@ OO.inheritClass( ve.ui.MWUseExistingReferenceDialogTool, ve.ui.WindowTool );
|
|||
ve.ui.MWUseExistingReferenceDialogTool.static.name = 'reference/existing';
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.group = 'object';
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.icon = 'reference-existing';
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.title =
|
||||
OO.ui.deferMsg( 'cite-ve-dialog-reference-useexisting-tool' );
|
||||
if ( mw.config.get( 'wgCiteVisualEditorOtherGroup' ) ) {
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.title = OO.ui.deferMsg(
|
||||
'cite-ve-othergroup-item',
|
||||
OO.ui.msg( 'cite-ve-dialog-reference-useexisting-tool' )
|
||||
);
|
||||
} else {
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.title = OO.ui.deferMsg(
|
||||
'cite-ve-dialog-reference-useexisting-tool'
|
||||
);
|
||||
}
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.commandName = 'reference/existing';
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToGroup = false;
|
||||
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToCatchall = false;
|
||||
|
|
Loading…
Reference in a new issue