mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-14 18:15:19 +00:00
efafed3231
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
52 lines
1.2 KiB
JavaScript
52 lines
1.2 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel LeafNode class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* DataModel leaf node.
|
|
*
|
|
* Leaf nodes can not have any children.
|
|
*
|
|
* @abstract
|
|
* @extends ve.dm.Node
|
|
* @mixins ve.LeafNode
|
|
* @constructor
|
|
* @param {number} [length] Length of content data in document
|
|
* @param {Object} [element] Reference to element in linear model
|
|
*/
|
|
ve.dm.LeafNode = function VeDmLeafNode( length, element ) {
|
|
// Mixin constructor
|
|
ve.LeafNode.call( this );
|
|
|
|
// Parent constructor
|
|
ve.dm.Node.call( this, length, element );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.dm.LeafNode, ve.dm.Node );
|
|
|
|
OO.mixinClass( ve.dm.LeafNode, ve.LeafNode );
|
|
|
|
/* Static properties */
|
|
|
|
ve.dm.LeafNode.static.childNodeTypes = [];
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Get the annotations that apply to the node.
|
|
*
|
|
* Annotations are grabbed directly from the linear model, so they are updated live. If the linear
|
|
* model element doesn't have a .annotations property, an empty array is returned.
|
|
*
|
|
* @method
|
|
* @returns {number[]} Annotation set indexes in the index-value store
|
|
*/
|
|
ve.dm.LeafNode.prototype.getAnnotations = function () {
|
|
return this.element.annotations || [];
|
|
};
|