mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
7c0b307d8a
Set up the surface widget as inside the reference dialog, and let the citation action notify the template dialog the name of the dialog it is in. If the tool was executed from within the reference dialog, skip over creating a reference and instead insert the citation as a template. * Depends on ve-core fix I709eeb0de475 * Bug: T94621 Change-Id: I4871f8c0afe190117cc90e88227b37f292a71e20
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWCitationAction class.
|
|
*
|
|
* @copyright 2011-2015 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
ve.ui.MWCitationAction = function VeUiMWCitationAction( surface ) {
|
|
// Parent constructor
|
|
ve.ui.Action.call( this, surface );
|
|
};
|
|
|
|
/* 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 );
|