mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-12 07:05:09 +00:00
73c90a0e7d
Some of the annotations were used in a way that confused jsdoc. This cleans up redundant annotations and uses more canonical tags. These changes cause all classes to now appear in the generated pages. Includes linking to external docs. Bug: T358641 Change-Id: Iaee1dadcc19a70c27839d0d27dfa6a07a70fb46b
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
'use strict';
|
|
|
|
/*!
|
|
* VisualEditor UserInterface MediaWiki ReferencesListCommand class.
|
|
*
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
|
|
/**
|
|
* References list command.
|
|
*
|
|
* If a references list node is selected, opens the dialog to edit it.
|
|
* Otherwise inserts the references list for the default group.
|
|
*
|
|
* @constructor
|
|
* @extends ve.ui.Command
|
|
*/
|
|
ve.ui.MWReferencesListCommand = function VeUiMWReferencesListCommand() {
|
|
// Parent constructor
|
|
ve.ui.MWReferencesListCommand.super.call(
|
|
this, 'referencesList', null, null,
|
|
{ supportedSelections: [ 'linear' ] }
|
|
);
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWReferencesListCommand, ve.ui.Command );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
ve.ui.MWReferencesListCommand.prototype.execute = function ( surface ) {
|
|
const fragment = surface.getModel().getFragment();
|
|
const selectedNode = fragment.getSelectedNode();
|
|
const isReflistNodeSelected = selectedNode &&
|
|
selectedNode instanceof ve.dm.MWReferencesListNode;
|
|
|
|
if ( isReflistNodeSelected ) {
|
|
return surface.execute( 'window', 'open', 'referencesList' );
|
|
} else {
|
|
fragment.collapseToEnd().insertContent( [
|
|
{
|
|
type: 'mwReferencesList',
|
|
attributes: {
|
|
listGroup: 'mwReference/',
|
|
refGroup: '',
|
|
isResponsive: mw.config.get( 'wgCiteResponsiveReferences' )
|
|
}
|
|
},
|
|
{ type: '/mwReferencesList' }
|
|
] );
|
|
return true;
|
|
}
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.commandRegistry.register( new ve.ui.MWReferencesListCommand() );
|