2023-08-21 08:08:23 +00:00
|
|
|
'use strict';
|
|
|
|
|
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-12-29 12:12:35 +00:00
|
|
|
* @license MIT
|
2016-02-03 21:03:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2021-09-30 08:50:57 +00:00
|
|
|
* Citation action.
|
2016-02-03 21:03:41 +00:00
|
|
|
*
|
2021-09-30 08:50:57 +00:00
|
|
|
* Opens the {@see ve.ui.MWCitationDialog} (via it's name "cite") in VisualEditor.
|
2016-02-03 21:03:41 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
2024-02-28 08:57:24 +00:00
|
|
|
* @extends ve.ui.Action
|
2016-02-03 21:03:41 +00:00
|
|
|
* @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';
|
|
|
|
|
|
|
|
ve.ui.MWCitationAction.static.methods = [ 'open' ];
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* When opening a citation, send the dialog a property of the surface
|
|
|
|
* dialog name.
|
|
|
|
*
|
|
|
|
* @param {Object} windowData Data to send to the dialog
|
|
|
|
* @return {boolean} Action was executed
|
|
|
|
*/
|
2019-02-15 14:57:44 +00:00
|
|
|
ve.ui.MWCitationAction.prototype.open = function ( windowData ) {
|
2024-06-06 15:28:53 +00:00
|
|
|
windowData = Object.assign( {
|
2016-02-03 21:03:41 +00:00
|
|
|
inDialog: this.surface.getInDialog()
|
|
|
|
}, windowData );
|
|
|
|
|
2019-02-15 14:57:44 +00:00
|
|
|
this.surface.execute( 'window', 'open', 'cite', windowData );
|
2016-02-03 21:03:41 +00:00
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.actionFactory.register( ve.ui.MWCitationAction );
|