Debian Codegraph @

extensions/Cite/modules/ve-cite/ve.ui.MWUseExistingReferenceCommand.js

raw symbols SCIP
1 'use strict';
2
3 /*!
4 * VisualEditor UserInterface MediaWiki UseExistingReferenceCommand class.
5 *
6 * @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
7 * @license MIT
8 */
9
10 /**
11 * Reuse existing reference command.
12 *
13 * @constructor
14 * @extends ve.ui.Command
15 */
16 ve.ui.MWUseExistingReferenceCommand = function VeUiMWUseExistingReferenceCommand() {
17 // Parent constructor
18 ve.ui.MWUseExistingReferenceCommand.super.call(
19 this, 'reference/existing', 'window', 'open',
20 { args: [ 'reference', { reuseReference: true } ], supportedSelections: [ 'linear' ] }
21 );
22 };
23
24 /* Inheritance */
25
26 OO.inheritClass( ve.ui.MWUseExistingReferenceCommand, ve.ui.Command );
27
28 /* Methods */
29
30 /**
31 * @override
32 */
33 ve.ui.MWUseExistingReferenceCommand.prototype.isExecutable = function ( fragment ) {
34 return ve.ui.MWUseExistingReferenceCommand.super.prototype.isExecutable.apply( this, arguments ) &&
35 ve.dm.MWDocumentReferences.static.refsForDoc( fragment.getDocument() ).hasRefs();
36 };
37
38 /* Registration */
39
40 ve.ui.commandRegistry.register( new ve.ui.MWUseExistingReferenceCommand() );