mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-20 02:01:20 +00:00
3a3437007a
Preserve the place of annotation meta tags; adds information for the users about annotation and, if necessary, annotation range extension. The messages and individual handling of annotations for the annotation range can be defined by the extensions: see I0b58a418 for an example of how that can look like. The structure of this patch closely follows the one from I104e7abbd (handling of <noinclude> et al.). Bug: T261181 Change-Id: I39029e4a63d22b37107edec066006557bcff34bf
55 lines
1.6 KiB
JavaScript
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.Context} context Context item is in
|
|
* @param {ve.dm.Model} model Model item is related to
|
|
* @param {Object} config Configuration options
|
|
*/
|
|
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 );
|