Debian Codegraph @

extensions/VisualEditor/lib/ve/src/ce/annotations/ve.ce.CommentAnnotation.js

raw symbols SCIP
1 /*!
2 * VisualEditor ContentEditable CommentAnnotation class.
3 *
4 * @copyright See AUTHORS.txt
5 */
6
7 /**
8 * ContentEditable comment annotation.
9 *
10 * @class
11 * @extends ve.ce.Annotation
12 * @constructor
13 * @param {ve.dm.CommentAnnotation} model Model to observe
14 * @param {ve.ce.ContentBranchNode} [parentNode] Node rendering this annotation
15 * @param {Object} [config] Configuration options
16 */
17 ve.ce.CommentAnnotation = function VeCeCommentAnnotation() {
18 // Parent constructor
19 ve.ce.CommentAnnotation.super.apply( this, arguments );
20
21 // DOM changes
22 this.$element.addClass( 've-ce-commentAnnotation' );
23 };
24
25 /* Inheritance */
26
27 OO.inheritClass( ve.ce.CommentAnnotation, ve.ce.Annotation );
28
29 /* Static Properties */
30
31 ve.ce.CommentAnnotation.static.name = 'commentAnnotation';
32
33 ve.ce.CommentAnnotation.static.tagName = 'span';
34
35 ve.ce.CommentAnnotation.static.canBeActive = true;
36
37 /* Static Methods */
38
39 /**
40 * @inheritdoc
41 */
42 ve.ce.CommentAnnotation.static.getDescription = function ( model ) {
43 const comments = model.getAttribute( 'comments' );
44
45 return comments[ 0 ].author + ': ' + comments[ 0 ].text;
46 };
47
48 /* Registration */
49
50 ve.ce.annotationFactory.register( ve.ce.CommentAnnotation );