2012-02-10 16:57:02 +00:00
|
|
|
/**
|
2012-03-06 22:39:43 +00:00
|
|
|
* Creates an ve.ce.LeafNode object.
|
2012-02-10 16:57:02 +00:00
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.LeafNode}
|
2012-03-06 22:39:43 +00:00
|
|
|
* @extends {ve.ce.Node}
|
2012-02-10 16:57:02 +00:00
|
|
|
* @param model {ve.ModelNode} Model to observe
|
|
|
|
* @param {jQuery} [$element] Element to use as a container
|
|
|
|
*/
|
2012-03-06 22:39:43 +00:00
|
|
|
ve.ce.LeafNode = function( model, $element ) {
|
2012-02-10 16:57:02 +00:00
|
|
|
// Inheritance
|
|
|
|
ve.LeafNode.call( this );
|
2012-03-06 22:39:43 +00:00
|
|
|
ve.ce.Node.call( this, model, $element );
|
2012-02-10 16:57:02 +00:00
|
|
|
|
|
|
|
this.$.data('view', this);
|
|
|
|
this.$.addClass('ce-leafNode');
|
|
|
|
|
|
|
|
// Properties
|
2012-03-07 08:13:12 +00:00
|
|
|
this.contentView = new ve.ce.Content( model, this.$, this );
|
2012-02-10 16:57:02 +00:00
|
|
|
|
|
|
|
// Events
|
|
|
|
this.contentView.on( 'update', this.emitUpdate );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Render content.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
2012-03-06 22:39:43 +00:00
|
|
|
ve.ce.LeafNode.prototype.renderContent = function() {
|
2012-02-10 16:57:02 +00:00
|
|
|
this.contentView.render();
|
|
|
|
};
|
|
|
|
|
2012-03-06 22:39:43 +00:00
|
|
|
ve.ce.LeafNode.prototype.getDOMText = function() {
|
2012-02-10 22:19:12 +00:00
|
|
|
return ve.ce.getDOMText( this.$[0] );
|
|
|
|
};
|
|
|
|
|
2012-02-10 16:57:02 +00:00
|
|
|
/* Inheritance */
|
|
|
|
|
2012-03-06 22:39:43 +00:00
|
|
|
ve.extendClass( ve.ce.LeafNode, ve.LeafNode );
|
|
|
|
ve.extendClass( ve.ce.LeafNode, ve.ce.Node );
|