mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2025-01-09 19:54:36 +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
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
/*!
|
|
* VisualEditor MWAnnotationContextItem class.
|
|
*
|
|
* @copyright 2011-2021 VisualEditor Team and others; see http://ve.mit-license.org
|
|
*/
|
|
|
|
/**
|
|
* Context item for a MWAnnotation
|
|
*
|
|
* @class
|
|
* @extends ve.ui.LinearContextItem
|
|
*
|
|
* @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.MWAnnotationContextItem = function VeUiMWAnnotationContextItem() {
|
|
// Parent constructor
|
|
ve.ui.MWAnnotationContextItem.super.apply( this, arguments );
|
|
|
|
// Initialization
|
|
this.$element.addClass( 've-ui-mwAnnotationContextItem' );
|
|
|
|
this.setLabel( this.getLabelMessage() );
|
|
|
|
this.$actions.remove();
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWAnnotationContextItem, ve.ui.LinearContextItem );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ui.MWAnnotationContextItem.static.editable = false;
|
|
|
|
ve.ui.MWAnnotationContextItem.static.name = 'mwAnnotation';
|
|
|
|
ve.ui.MWAnnotationContextItem.static.icon = 'markup';
|
|
|
|
ve.ui.MWAnnotationContextItem.static.modelClasses = [
|
|
ve.dm.MWAnnotationNode
|
|
];
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
ve.ui.MWAnnotationContextItem.prototype.renderBody = function () {
|
|
this.$body.empty();
|
|
|
|
var $desc = this.getDescriptionMessage();
|
|
if ( $desc ) {
|
|
this.$body.append( $desc ).append( mw.msg( 'word-separator' ) );
|
|
}
|
|
|
|
if ( this.model.getAttribute( 'mw' ) ) {
|
|
if ( this.model.getAttribute( 'mw' ).extendedRange ) {
|
|
this.$body.append( mw.message( 'visualeditor-annotations-extended-documentation' ).parseDom() );
|
|
}
|
|
}
|
|
};
|