2016-02-03 21:03:41 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface MWCitationAction class.
|
|
|
|
*
|
2018-01-03 01:05:45 +00:00
|
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
2017-04-20 16:08:44 +00:00
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
2016-02-03 21:03:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Link action.
|
|
|
|
*
|
|
|
|
* Opens either MWLinkAnnotationInspector or MWLinkNodeInspector depending on what is selected.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.Action
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.ui.Surface} surface Surface to act on
|
|
|
|
*/
|
2016-11-02 12:43:14 +00:00
|
|
|
ve.ui.MWCitationAction = function VeUiMWCitationAction() {
|
2016-02-03 21:03:41 +00:00
|
|
|
// Parent constructor
|
2016-11-02 12:43:14 +00:00
|
|
|
ve.ui.MWCitationAction.super.apply( this, arguments );
|
2016-02-03 21:03:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWCitationAction, ve.ui.Action );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.MWCitationAction.static.name = 'mwcite';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWCitationAction.static.methods = [ 'open' ];
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When opening a citation, send the dialog a property of the surface
|
|
|
|
* dialog name.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @param {string} windowName Dialog name to open
|
|
|
|
* @param {Object} windowData Data to send to the dialog
|
|
|
|
* @return {boolean} Action was executed
|
|
|
|
*/
|
|
|
|
ve.ui.MWCitationAction.prototype.open = function ( windowName, windowData ) {
|
|
|
|
windowData = $.extend( {
|
|
|
|
inDialog: this.surface.getInDialog()
|
|
|
|
}, windowData );
|
|
|
|
|
|
|
|
this.surface.execute( 'window', 'open', windowName, windowData );
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.actionFactory.register( ve.ui.MWCitationAction );
|