All files / src/ce/nodes ve.ce.InlineImageNode.js

100% Statements 10/10
100% Branches 0/0
100% Functions 1/1
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58                                    1x 59x         59x     59x     59x                           1x   1x       1x   1x       1x  
/*!
 * VisualEditor ContentEditable InlineImageNode class.
 *
 * @copyright See AUTHORS.txt
 */
 
/**
 * ContentEditable inline image node.
 *
 * @class
 * @extends ve.ce.LeafNode
 * @mixes ve.ce.ImageNode
 * @mixes ve.ce.ResizableNode
 *
 * @constructor
 * @param {ve.dm.InlineImageNode} model Model to observe
 * @param {Object} [config] Configuration options
 */
ve.ce.InlineImageNode = function VeCeInlineImageNode( model, config ) {
	config = ve.extendObject( {
		minDimensions: { width: 1, height: 1 }
	}, config );
 
	// Parent constructor
	ve.ce.InlineImageNode.super.call( this, model, config );
 
	// Mixin constructors
	ve.ce.ImageNode.call( this, this.$element, null, config );
 
	// Initialization
	this.$element
		.addClass( 've-ce-inlineImageNode' )
		.prop( {
			alt: this.model.getAttribute( 'alt' ),
			src: this.getResolvedAttribute( 'src' )
		} )
		.css( {
			width: this.model.getAttribute( 'width' ),
			height: this.model.getAttribute( 'height' )
		} );
};
 
/* Inheritance */
 
OO.inheritClass( ve.ce.InlineImageNode, ve.ce.LeafNode );
 
OO.mixinClass( ve.ce.InlineImageNode, ve.ce.ImageNode );
 
/* Static Properties */
 
ve.ce.InlineImageNode.static.name = 'inlineImage';
 
ve.ce.InlineImageNode.static.tagName = 'img';
 
/* Registration */
 
ve.ce.nodeFactory.register( ve.ce.InlineImageNode );