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
|
|
|
|
2012-04-04 18:53:23 +00:00
|
|
|
this.$.data( 'view', this );
|
|
|
|
this.$.addClass( 've-ce-leafNode' );
|
2012-02-10 16:57:02 +00:00
|
|
|
|
|
|
|
// 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 */
|
|
|
|
|
2012-04-05 21:31:59 +00:00
|
|
|
ve.ce.LeafNode.prototype.convertDomElement = function( type ) {
|
|
|
|
ve.ce.Node.prototype.call( this, type );
|
|
|
|
// Transplant content view
|
|
|
|
this.contentView.setContainer( this.$ );
|
|
|
|
};
|
|
|
|
|
2012-02-10 16:57:02 +00:00
|
|
|
/**
|
|
|
|
* 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 );
|