mediawiki-extensions-Visual.../modules/ve-mw/ui/contextitems/ve.ui.MWAlienAnnotationContextItem.js
Ed Sanders 2a1076e295 Fix ContextItem documentation
* Be more specific about the type of context which a
  context item belongs to.
* Make grammar clearer.

Change-Id: Ic480411cead80a1651c61ce9841dfbdc24a7b915
2023-07-10 14:32:12 +01:00

55 lines
1.6 KiB
JavaScript

/*!
* VisualEditor MWAlienAnnotationContextItem class.
*
* @copyright 2011-2021 VisualEditor Team and others; see http://ve.mit-license.org
*/
/**
* Context item for a MWAlienAnnotation
*
* @class
* @extends ve.ui.MWAnnotationContextItem
*
* @constructor
* @param {ve.ui.LinearContext} context Context the item is in
* @param {ve.dm.Model} model Model the item is related to
* @param {Object} [config]
*/
ve.ui.MWAlienAnnotationContextItem = function VeUiMWAlienAnnotationContextItem() {
// Parent constructor
ve.ui.MWAlienAnnotationContextItem.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWAlienAnnotationContextItem, ve.ui.MWAnnotationContextItem );
/* Static Properties */
ve.ui.MWAlienAnnotationContextItem.static.name = 'mwAlienAnnotation';
ve.ui.MWAlienAnnotationContextItem.static.modelClasses = [
ve.dm.MWAlienAnnotationNode
];
/* Methods */
ve.ui.MWAlienAnnotationContextItem.prototype.getLabelMessage = function () {
var type = this.model.getAttribute( 'type' );
if ( type.indexOf( '/End', type.length - 4 ) !== -1 ) {
return mw.message( 'visualeditor-annotations-default-end' ).text();
} else {
return mw.message( 'visualeditor-annotations-default-start' ).text();
}
};
ve.ui.MWAlienAnnotationContextItem.prototype.getDescriptionMessage = function () {
var type = this.model.getAttribute( 'type' );
if ( type.indexOf( '/End', type.length - 4 ) !== -1 ) {
return '';
}
return mw.message( 'visualeditor-annotations-default-description' ).parseDom();
};
ve.ui.contextItemFactory.register( ve.ui.MWAlienAnnotationContextItem );