2015-08-25 05:48:16 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MWMagicLinkNodeContextItem class.
|
|
|
|
*
|
2019-01-01 13:24:23 +00:00
|
|
|
* @copyright 2011-2019 VisualEditor Team and others; see http://ve.mit-license.org
|
2015-08-25 05:48:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context item for a MWMagicLinkNode.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.LinkContextItem
|
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.ui.Context} context Context item is in
|
|
|
|
* @param {ve.dm.MWMagicLinkNode} model Model item is related to
|
|
|
|
* @param {Object} config Configuration options
|
|
|
|
*/
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem = function VeUiMWMagicLinkNodeContextItem() {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.super.apply( this, arguments );
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
this.$element.addClass( 've-ui-mwMagicLinkNodeContextItem' );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
OO.inheritClass( ve.ui.MWMagicLinkNodeContextItem, ve.ui.LinkContextItem );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.static.name = 'link/mwMagic';
|
|
|
|
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.static.label = null; // see #setup()
|
|
|
|
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.static.modelClasses = [ ve.dm.MWMagicLinkNode ];
|
|
|
|
|
2017-03-07 15:34:18 +00:00
|
|
|
ve.ui.MWMagicLinkNodeContextItem.static.clearable = false;
|
|
|
|
|
2015-08-25 05:48:16 +00:00
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.prototype.setup = function () {
|
|
|
|
// Set up label
|
|
|
|
var msg = 'visualeditor-magiclinknodeinspector-title-' +
|
|
|
|
this.model.getMagicType().toLowerCase();
|
2019-11-01 16:20:22 +00:00
|
|
|
|
|
|
|
// The following messages are used here:
|
|
|
|
// * visualeditor-magiclinknodeinspector-title-isbn
|
|
|
|
// * visualeditor-magiclinknodeinspector-title-pmid
|
|
|
|
// * visualeditor-magiclinknodeinspector-title-rfc
|
2015-08-25 05:48:16 +00:00
|
|
|
this.setLabel( OO.ui.deferMsg( msg ) );
|
2019-11-01 16:20:22 +00:00
|
|
|
|
2015-08-25 05:48:16 +00:00
|
|
|
// Invoke superclass method.
|
|
|
|
return ve.ui.MWMagicLinkNodeContextItem.super.prototype.setup.call( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.prototype.getDescription = function () {
|
|
|
|
return this.model.getAttribute( 'content' );
|
|
|
|
};
|
|
|
|
|
2019-02-24 13:25:23 +00:00
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.prototype.renderBody = function () {
|
|
|
|
// Parent method
|
|
|
|
ve.ui.MWMagicLinkNodeContextItem.super.prototype.renderBody.apply( this, arguments );
|
|
|
|
|
|
|
|
this.$labelLayout.remove();
|
|
|
|
};
|
2015-08-25 05:48:16 +00:00
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ui.contextItemFactory.register( ve.ui.MWMagicLinkNodeContextItem );
|