mediawiki-extensions-Visual.../modules/ve/ce/ve.ce.LeafNode.js

46 lines
936 B
JavaScript
Raw Normal View History

2012-02-10 16:57:02 +00:00
/**
* Creates an ve.ce.LeafNode object.
2012-02-10 16:57:02 +00:00
*
* @class
* @abstract
* @constructor
* @extends {ve.LeafNode}
* @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
*/
ve.ce.LeafNode = function( model, $element ) {
2012-02-10 16:57:02 +00:00
// Inheritance
ve.LeafNode.call( this );
ve.ce.Node.call( this, model, $element );
2012-02-10 16:57:02 +00:00
this.$.data('view', this);
this.$.addClass('ce-leafNode');
// Properties
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
*/
ve.ce.LeafNode.prototype.renderContent = function() {
2012-02-10 16:57:02 +00:00
this.contentView.render();
};
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 */
ve.extendClass( ve.ce.LeafNode, ve.LeafNode );
ve.extendClass( ve.ce.LeafNode, ve.ce.Node );