mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-24 20:42:58 +00:00
ab0f2ea000
Bug: T370875 Change-Id: I6ed43ea3a5b25c2ef5afc373b5a2523a730fd11e
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
'use strict';
|
|
|
|
/*!
|
|
* VisualEditor UserInterface MediaWiki UseExistingReferenceCommand class.
|
|
*
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
|
|
/**
|
|
* Reuse existing reference command.
|
|
*
|
|
* @constructor
|
|
* @extends ve.ui.Command
|
|
*/
|
|
ve.ui.MWUseExistingReferenceCommand = function VeUiMWUseExistingReferenceCommand() {
|
|
// Parent constructor
|
|
ve.ui.MWUseExistingReferenceCommand.super.call(
|
|
this, 'reference/existing', 'window', 'open',
|
|
{ args: [ 'reference', { reuseReference: true } ], supportedSelections: [ 'linear' ] }
|
|
);
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWUseExistingReferenceCommand, ve.ui.Command );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @override
|
|
*/
|
|
ve.ui.MWUseExistingReferenceCommand.prototype.isExecutable = function ( fragment ) {
|
|
return ve.ui.MWUseExistingReferenceCommand.super.prototype.isExecutable.apply( this, arguments ) &&
|
|
ve.dm.MWDocumentReferences.static.refsForDoc( fragment.getDocument() ).hasRefs();
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.commandRegistry.register( new ve.ui.MWUseExistingReferenceCommand() );
|