mediawiki-extensions-Visual.../modules/ve-mw/ce/nodes/ve.ce.MWMagicLinkNode.js
Bartosz Dziewoński 84d548e7b1 Remove redundant @method annotations
A @method annotation is only necessary when the docblock is not
directly followed by a function declaration (in which case JSDuck
assumes it documents a property), e.g. when defining an abstract
function or referencing a function from another library.

I verified that JSDuck generates exactly the same output before and
after this change (docs/data-<hash>.js files are identical).

Change-Id: I7edf51a8560ab9978b42800ab1026f0b5555c3bf
2019-08-21 23:33:15 +02:00

76 lines
1.6 KiB
JavaScript

/*!
* VisualEditor ContentEditable MWMagicLinkNode class.
*
* @copyright 2011-2019 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable MediaWiki magic link node.
*
* @class
* @extends ve.ce.LeafNode
* @mixins ve.ce.FocusableNode
* @constructor
* @param {ve.dm.MWMagicLinkNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWMagicLinkNode = function VeCeMWMagicLinkNode() {
// Parent constructor
ve.ce.MWMagicLinkNode.super.apply( this, arguments );
// Mixin constructors
ve.ce.FocusableNode.call( this );
// DOM changes
this.$element.addClass( 've-ce-mwMagicLinkNode' );
// Add link
this.$link = $( '<a>' ).appendTo( this.$element );
// Events
this.model.connect( this, { update: 'onUpdate' } );
// Initialization
this.onUpdate();
};
/* Inheritance */
OO.inheritClass( ve.ce.MWMagicLinkNode, ve.ce.LeafNode );
OO.mixinClass( ve.ce.MWMagicLinkNode, ve.ce.FocusableNode );
/* Static Properties */
ve.ce.MWMagicLinkNode.static.name = 'link/mwMagic';
ve.ce.MWMagicLinkNode.static.tagName = 'span';
ve.ce.MWMagicLinkNode.static.primaryCommandName = 'link';
/* Static Methods */
/**
* @inheritdoc
*/
ve.ce.MWMagicLinkNode.static.getDescription = function ( model ) {
return model.getAttribute( 'content' );
};
/* Methods */
/**
* Handle model update events.
*/
ve.ce.MWMagicLinkNode.prototype.onUpdate = function () {
this.$link
.attr( 'href', this.model.getHref() )
.attr( 'rel', this.model.getRel() )
.text( this.model.getAttribute( 'content' ) );
};
/* Registration */
ve.ce.nodeFactory.register( ve.ce.MWMagicLinkNode );