mediawiki-extensions-Visual.../modules/ve/ce/ve.ce.Annotation.js
Catrope 2eb77c1298 Add ve.ce.View as a common base class for ce.Node and ce.Annotation
Just like ve.dm.Model is a common base class for dm.Node, dm.Annotation
and dm.MetaItem.

ce.View abstracts the this.model and this.$ behavior, including liveness,
whitelisted HTML attribute rendering and adding a back reference in
.data(). The back reference has been renamed from .data( 'node' ) to
the more generic .data( 'view' ).

At this point this means ce.Annotation is just a shell around ce.View
(except where it defaults to a span rather than a div), but that could
change in the future.

Change-Id: I0eef5b80718e0b0fcd3f8bba096b452f0bb680d0
2013-04-09 12:05:05 -07:00

31 lines
888 B
JavaScript

/*!
* VisualEditor ContentEditable Annotation class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Generic ContentEditable annotation.
*
* This is an abstract class, annotations should extend this and call this constructor from their
* constructor. You should not instantiate this class directly.
*
* Subclasses of ve.dm.Annotation should have a corresponding subclass here that controls rendering.
*
* @abstract
* @extends ve.ce.View
*
* @constructor
* @param {ve.dm.Annotation} model Model to observe
* @param {jQuery} [$element] Element to use as a container
*/
ve.ce.Annotation = function VeCeAnnotation( model, $element ) {
// Parent constructor
ve.ce.View.call( this, model, $element || $( '<span>' ) );
};
/* Inheritance */
ve.inheritClass( ve.ce.Annotation, ve.ce.View );