2023-08-21 08:08:23 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-02-03 21:03:41 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MediaWiki Reference dialog tool classes.
|
|
|
|
*
|
2018-01-03 01:05:45 +00:00
|
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
2017-12-29 12:12:35 +00:00
|
|
|
* @license MIT
|
2016-02-03 21:03:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MediaWiki UserInterface reference tool.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.FragmentWindowTool
|
|
|
|
* @constructor
|
|
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
|
|
|
ve.ui.MWReferenceDialogTool = function VeUiMWReferenceDialogTool() {
|
|
|
|
ve.ui.MWReferenceDialogTool.super.apply( this, arguments );
|
|
|
|
};
|
|
|
|
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';
|
2016-04-27 20:03:49 +00:00
|
|
|
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'
|
|
|
|
);
|
|
|
|
}
|
2016-02-03 21:03:41 +00:00
|
|
|
ve.ui.MWReferenceDialogTool.static.modelClasses = [ ve.dm.MWReferenceNode ];
|
|
|
|
ve.ui.MWReferenceDialogTool.static.commandName = 'reference';
|
|
|
|
ve.ui.MWReferenceDialogTool.static.autoAddToCatchall = false;
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWReferenceDialogTool );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MediaWiki UserInterface use existing reference tool.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.WindowTool
|
|
|
|
* @constructor
|
|
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
|
|
|
ve.ui.MWUseExistingReferenceDialogTool = function VeUiMWUseExistingReferenceDialogTool() {
|
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.super.apply( this, arguments );
|
|
|
|
};
|
|
|
|
OO.inheritClass( ve.ui.MWUseExistingReferenceDialogTool, ve.ui.WindowTool );
|
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.name = 'reference/existing';
|
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.group = 'object';
|
2023-02-11 14:07:01 +00:00
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.icon = 'referenceExisting';
|
2016-04-27 20:03:49 +00:00
|
|
|
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'
|
|
|
|
);
|
|
|
|
}
|
2016-02-03 21:03:41 +00:00
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.commandName = 'reference/existing';
|
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToGroup = false;
|
|
|
|
ve.ui.MWUseExistingReferenceDialogTool.static.autoAddToCatchall = false;
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWUseExistingReferenceDialogTool );
|
|
|
|
|
|
|
|
ve.ui.commandRegistry.register(
|
|
|
|
new ve.ui.Command(
|
|
|
|
'reference', 'window', 'open',
|
|
|
|
{ args: [ 'reference' ], supportedSelections: [ 'linear' ] }
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
/* If Citoid is installed these will be overridden */
|
|
|
|
ve.ui.sequenceRegistry.register(
|
|
|
|
new ve.ui.Sequence( 'wikitextRef', 'reference', '<ref', 4 )
|
|
|
|
);
|
|
|
|
|
2016-11-03 16:34:49 +00:00
|
|
|
ve.ui.triggerRegistry.register(
|
2017-07-18 11:57:48 +00:00
|
|
|
'reference', { mac: new ve.ui.Trigger( 'cmd+shift+k' ), pc: new ve.ui.Trigger( 'ctrl+shift+k' ) }
|
2016-11-03 16:34:49 +00:00
|
|
|
);
|
|
|
|
|
2016-02-03 21:03:41 +00:00
|
|
|
ve.ui.commandHelpRegistry.register( 'insert', 'ref', {
|
2016-11-03 16:34:49 +00:00
|
|
|
trigger: 'reference',
|
2016-02-03 21:03:41 +00:00
|
|
|
sequences: [ 'wikitextRef' ],
|
|
|
|
label: OO.ui.deferMsg( 'cite-ve-dialog-reference-title' )
|
|
|
|
} );
|
|
|
|
|
2016-04-12 11:13:55 +00:00
|
|
|
ve.ui.mwWikitextTransferRegistry.register( 'reference', /<ref[^>]*>/ );
|
2016-03-05 16:55:43 +00:00
|
|
|
|
2023-05-21 10:16:25 +00:00
|
|
|
ve.ui.HelpCompletionAction.static.toolGroups.cite = { mergeWith: 'insert' };
|
|
|
|
|
2016-02-03 21:03:41 +00:00
|
|
|
/**
|
|
|
|
* MediaWiki UserInterface references list tool.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.FragmentWindowTool
|
|
|
|
* @constructor
|
|
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
|
|
* @param {Object} [config] Configuration options
|
|
|
|
*/
|
|
|
|
ve.ui.MWReferencesListDialogTool = function VeUiMWReferencesListDialogTool() {
|
|
|
|
ve.ui.MWReferencesListDialogTool.super.apply( this, arguments );
|
|
|
|
};
|
|
|
|
OO.inheritClass( ve.ui.MWReferencesListDialogTool, ve.ui.FragmentWindowTool );
|
|
|
|
ve.ui.MWReferencesListDialogTool.static.name = 'referencesList';
|
|
|
|
ve.ui.MWReferencesListDialogTool.static.group = 'object';
|
|
|
|
ve.ui.MWReferencesListDialogTool.static.icon = 'references';
|
|
|
|
ve.ui.MWReferencesListDialogTool.static.title =
|
|
|
|
OO.ui.deferMsg( 'cite-ve-dialogbutton-referenceslist-tooltip' );
|
|
|
|
ve.ui.MWReferencesListDialogTool.static.modelClasses = [ ve.dm.MWReferencesListNode ];
|
|
|
|
ve.ui.MWReferencesListDialogTool.static.commandName = 'referencesList';
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWReferencesListDialogTool );
|