mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-23 20:12:57 +00:00
dc67570f96
I found that the code is in some cases not clear with the terminlogy. Let's start by making it at least more clear what's related to the "reuse" use case. Change-Id: I5325489be3b14276b0163d8cb8b84215b55d041e
53 lines
1.2 KiB
JavaScript
53 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
/*!
|
|
* VisualEditor UserInterface MWCitationAction class.
|
|
*
|
|
* @copyright 2011-2018 VisualEditor Team's Cite sub-team and others; see AUTHORS.txt
|
|
* @license MIT
|
|
*/
|
|
|
|
/**
|
|
* Opens the {@see ve.ui.MWCitationDialog} (via it's name "cite") in VisualEditor.
|
|
*
|
|
* @constructor
|
|
* @extends ve.ui.Action
|
|
* @param {ve.ui.Surface} surface Surface to act on
|
|
*/
|
|
ve.ui.MWCitationAction = function VeUiMWCitationAction() {
|
|
// Parent constructor
|
|
ve.ui.MWCitationAction.super.apply( this, arguments );
|
|
};
|
|
|
|
/* 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
|
|
*/
|
|
ve.ui.MWCitationAction.prototype.open = function ( windowData ) {
|
|
windowData = Object.assign( {
|
|
inDialog: this.surface.getInDialog()
|
|
}, windowData );
|
|
|
|
this.surface.execute( 'window', 'open', 'cite', windowData );
|
|
return true;
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.actionFactory.register( ve.ui.MWCitationAction );
|