Debian Codegraph @

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

raw symbols SCIP
1 'use strict';
2
3 /*!
4 * VisualEditor UserInterface MWCitationAction class.
5 *
6 * @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
7 * @license MIT
8 */
9
10 /**
11 * Opens the {@see ve.ui.MWCitationDialog} (via it's name "cite") in VisualEditor.
12 *
13 * @constructor
14 * @extends ve.ui.Action
15 * @param {ve.ui.Surface} surface Surface to act on
16 */
17 ve.ui.MWCitationAction = function VeUiMWCitationAction() {
18 // Parent constructor
19 ve.ui.MWCitationAction.super.apply( this, arguments );
20 };
21
22 /* Inheritance */
23
24 OO.inheritClass( ve.ui.MWCitationAction, ve.ui.Action );
25
26 /* Static Properties */
27
28 ve.ui.MWCitationAction.static.name = 'mwcite';
29
30 ve.ui.MWCitationAction.static.methods = [ 'open' ];
31
32 /* Methods */
33
34 /**
35 * When opening a citation, send the dialog a property of the surface
36 * dialog name.
37 *
38 * @param {Object} windowData Data to send to the dialog
39 * @return {boolean} Action was executed
40 */
41 ve.ui.MWCitationAction.prototype.open = function ( windowData ) {
42 windowData = Object.assign( {
43 inDialog: this.surface.getInDialog()
44 }, windowData );
45
46 this.surface.execute( 'window', 'open', 'cite', windowData );
47 return true;
48 };
49
50 /* Registration */
51
52 ve.ui.actionFactory.register( ve.ui.MWCitationAction );