2021-10-01 11:16:11 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor MWAlienAnnotationContextItem class.
|
|
|
|
*
|
2023-12-01 16:06:11 +00:00
|
|
|
* @copyright See AUTHORS.txt
|
2021-10-01 11:16:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Context item for a MWAlienAnnotation
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @extends ve.ui.MWAnnotationContextItem
|
|
|
|
*
|
|
|
|
* @constructor
|
2023-07-10 13:31:31 +00:00
|
|
|
* @param {ve.ui.LinearContext} context Context the item is in
|
|
|
|
* @param {ve.dm.Model} model Model the item is related to
|
2023-02-02 09:47:32 +00:00
|
|
|
* @param {Object} [config]
|
2021-10-01 11:16:11 +00:00
|
|
|
*/
|
|
|
|
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 () {
|
2024-05-21 14:22:56 +00:00
|
|
|
const type = this.model.getAttribute( 'type' );
|
2021-10-01 11:16:11 +00:00
|
|
|
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 () {
|
2024-05-21 14:22:56 +00:00
|
|
|
const type = this.model.getAttribute( 'type' );
|
2021-10-01 11:16:11 +00:00
|
|
|
if ( type.indexOf( '/End', type.length - 4 ) !== -1 ) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return mw.message( 'visualeditor-annotations-default-description' ).parseDom();
|
|
|
|
};
|
|
|
|
|
|
|
|
ve.ui.contextItemFactory.register( ve.ui.MWAlienAnnotationContextItem );
|