2015-08-25 05:48:16 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MWMagicLinkNodeContextItem class.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright See AUTHORS.txt
|
2015-08-25 05:48:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context item for a MWMagicLinkNode.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.LinkContextItem
|
|
|
|
*
|
|
|
|
* @constructor
|
2023-07-10 13:31:31 +00:00
|
|
|
* @param {ve.ui.LinearContext} context Context the item is in
|
|
|
|
* @param {ve.dm.MWMagicLinkNode} model Model the item is related to
|
2023-02-02 09:47:32 +00:00
|
|
|
* @param {Object} [config]
|
2015-08-25 05:48:16 +00:00
|
|
|
*/
|
|
|
|
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
|
2024-05-21 14:22:56 +00:00
|
|
|
const msg = 'visualeditor-magiclinknodeinspector-title-' +
|
2015-08-25 05:48:16 +00:00
|
|
|
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 );
|