mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
0b55bb8cdc
ve.dm.Model is now the common base class for these three. ve.dm.Node inherited from ve.Node before, so it now uses it as a mixin instead. This required changing ve.Node's usage of ve.EventEmitter from inhertiance to a mixin as well, because inherited methods apparently don't get mixed in correctly. * Change annotation terminology from linmodAnnotation to element for consistency with Node, MetaItem and Model * Reimplement getClonedElement() in Node for .internal treatment Change-Id: Ifd3922af23557c0b0f8984d36b31c8a1e2ec497e
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
/*!
|
|
* VisualEditor DataModel Annotation class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Generic DataModel annotation.
|
|
*
|
|
* This is an abstract class, annotations should extend this and call this constructor from their
|
|
* constructor. You should not instantiate this class directly.
|
|
*
|
|
* Annotations in the linear model are instances of subclasses of this class. Subclasses should
|
|
* only override static properties and functions.
|
|
*
|
|
* @class
|
|
* @constructor
|
|
* @param {Object} element Linear model annotation
|
|
*/
|
|
ve.dm.Annotation = function VeDmAnnotation( element ) {
|
|
// Parent constructor
|
|
ve.dm.Model.call( this, element );
|
|
// Properties
|
|
this.name = this.constructor.static.name; // For ease of filtering
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.dm.Annotation, ve.dm.Model );
|
|
|
|
/* Static properties */
|
|
|
|
/**
|
|
* About grouping is not supported for annotations; setting this to true has no effect.
|
|
*
|
|
* @static
|
|
* @property {boolean} static.enableAboutGrouping
|
|
* @inheritable
|
|
*/
|
|
ve.dm.Annotation.static.enableAboutGrouping = false;
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Convenience wrapper for .toDomElements() on the current annotation
|
|
* @method
|
|
* @see ve.dm.Model#toDomElements
|
|
*/
|
|
ve.dm.Annotation.prototype.getDomElements = function () {
|
|
return this.constructor.static.toDomElements( this.element );
|
|
};
|