mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 08:34:54 +00:00
a2eee63525
Also: * Simplified ve.ce.Surface.getLeafNode, which may be better to just be removed and be used inline in the few places it's being used. * Removed method wrapper for static function ve.ce.Surface.getLeafNode Change-Id: I1d4cf0bb7ecc8f07f030753e40a13ebef7d02daa
46 lines
943 B
JavaScript
46 lines
943 B
JavaScript
/**
|
|
* Creates an ve.ce.LeafNode object.
|
|
*
|
|
* @class
|
|
* @abstract
|
|
* @constructor
|
|
* @extends {ve.LeafNode}
|
|
* @extends {ve.ce.Node}
|
|
* @param model {ve.ModelNode} Model to observe
|
|
* @param {jQuery} [$element] Element to use as a container
|
|
*/
|
|
ve.ce.LeafNode = function( model, $element ) {
|
|
// Inheritance
|
|
ve.LeafNode.call( this );
|
|
ve.ce.Node.call( this, model, $element );
|
|
|
|
this.$.data( 'view', this );
|
|
this.$.addClass( 've-ce-leafNode' );
|
|
|
|
// Properties
|
|
this.contentView = new ve.ce.Content( model, this.$, this );
|
|
|
|
// Events
|
|
this.contentView.on( 'update', this.emitUpdate );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Render content.
|
|
*
|
|
* @method
|
|
*/
|
|
ve.ce.LeafNode.prototype.renderContent = function() {
|
|
this.contentView.render();
|
|
};
|
|
|
|
ve.ce.LeafNode.prototype.getDOMText = function() {
|
|
return ve.ce.getDOMText( this.$[0] );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.extendClass( ve.ce.LeafNode, ve.LeafNode );
|
|
ve.extendClass( ve.ce.LeafNode, ve.ce.Node );
|