Added very basic support (rendering) for captions of thumb and frame images.

Change-Id: I4a59d4601c9bf44b241bb1432c9f1abc3f961743
This commit is contained in:
Inez Korczyński 2013-05-17 12:40:12 -07:00
parent 6c367b9998
commit 7c8bc08470

View file

@ -17,6 +17,8 @@
* @param {Object} [config] Config options
*/
ve.ce.MWBlockImageNode = function VeCeMWBlockImageNode( model, config ) {
var captionModel, captionView;
// Parent constructor
ve.ce.BranchNode.call( this, model, config );
@ -52,6 +54,19 @@ ve.ce.MWBlockImageNode = function VeCeMWBlockImageNode( model, config ) {
.attr( 'width', this.model.getAttribute( 'width' ) )
.attr( 'height', this.model.getAttribute( 'height' ) )
.appendTo( this.$a );
// I smell a caption!
if ( this.model.children.length === 1 ) {
captionModel = this.model.children[0];
captionView = ve.ce.nodeFactory.create( captionModel.getType(), captionModel );
captionModel.connect( this, { 'update': 'onModelUpdate' } );
this.children.push( captionView );
captionView.attach( this );
captionView.$.appendTo( this.$thumbInner );
if ( this.live !== captionView.isLive() ) {
captionView.setLive( this.live );
}
}
};
/* Inheritance */