mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 23:05:31 +00:00
18f616b9b8
This code has been developed over three years now in the repo of MediaWiki's integration of VisualEditor. It has grown and developed significantly during that time, but now is pretty stable. A number of hacks inside the MediaWiki- VisualEditor code base have been used to prevent this code from being loaded on wikis where the Cite extension is not deployed, but this state of affairs is and always was meant to be temporary. This code is under the MIT licence which is a tad messy, but not impossible. It's clearly labelled as such. The list of authors has been updated to take into account the influx of new functionality. Bug: T41621 Bug: T104928 Change-Id: I39936ed83d5a60471a0a75da753f498e80aef234
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWCitationAction class.
|
|
*
|
|
* @copyright 2011-2016 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 );
|