Debian Codegraph @

extensions/VisualEditor/modules/ve-mw/ui/contextitems/ve.ui.MWMagicLinkNodeContextItem.js

raw symbols SCIP
1 /*!
2 * VisualEditor MWMagicLinkNodeContextItem class.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * Context item for a MWMagicLinkNode.
9 *
10 * @class
11 * @extends ve.ui.LinkContextItem
12 *
13 * @constructor
14 * @param {ve.ui.LinearContext} context Context the item is in
15 * @param {ve.dm.MWMagicLinkNode} model Model the item is related to
16 * @param {Object} [config]
17 */
18 ve.ui.MWMagicLinkNodeContextItem = function VeUiMWMagicLinkNodeContextItem() {
19 // Parent constructor
20 ve.ui.MWMagicLinkNodeContextItem.super.apply( this, arguments );
21
22 // Initialization
23 this.$element.addClass( 've-ui-mwMagicLinkNodeContextItem' );
24 };
25
26 /* Inheritance */
27
28 OO.inheritClass( ve.ui.MWMagicLinkNodeContextItem, ve.ui.LinkContextItem );
29
30 /* Static Properties */
31
32 ve.ui.MWMagicLinkNodeContextItem.static.name = 'link/mwMagic';
33
34 ve.ui.MWMagicLinkNodeContextItem.static.label = null; // see #setup()
35
36 ve.ui.MWMagicLinkNodeContextItem.static.modelClasses = [ ve.dm.MWMagicLinkNode ];
37
38 ve.ui.MWMagicLinkNodeContextItem.static.clearable = false;
39
40 /* Methods */
41
42 ve.ui.MWMagicLinkNodeContextItem.prototype.setup = function () {
43 // Set up label
44 const msg = 'visualeditor-magiclinknodeinspector-title-' +
45 this.model.getMagicType().toLowerCase();
46
47 // The following messages are used here:
48 // * visualeditor-magiclinknodeinspector-title-isbn
49 // * visualeditor-magiclinknodeinspector-title-pmid
50 // * visualeditor-magiclinknodeinspector-title-rfc
51 this.setLabel( OO.ui.deferMsg( msg ) );
52
53 // Invoke superclass method.
54 return ve.ui.MWMagicLinkNodeContextItem.super.prototype.setup.call( this );
55 };
56
57 ve.ui.MWMagicLinkNodeContextItem.prototype.getDescription = function () {
58 return this.model.getAttribute( 'content' );
59 };
60
61 /**
62 * @inheritdoc
63 */
64 ve.ui.MWMagicLinkNodeContextItem.prototype.renderBody = function () {
65 // Parent method
66 ve.ui.MWMagicLinkNodeContextItem.super.prototype.renderBody.apply( this, arguments );
67
68 this.$labelLayout.remove();
69 };
70 /* Registration */
71
72 ve.ui.contextItemFactory.register( ve.ui.MWMagicLinkNodeContextItem );