Make sure <figure> has proper dimensions

This commit brings back the sizing of the <figure> in MWBlockImageNode.
The figure must have proper size in CE otherwise 'center' and 'none'
alignments don't work, and the <figure> stretches across the entire
width of the screen.

Bug: 65836
Change-Id: Iefed466fce87f265fbd08908f1171867f9d1e1fe
This commit is contained in:
Moriel Schottlender 2014-05-27 21:44:58 -04:00
parent 9a8720bf90
commit 186238e90d

View file

@ -206,6 +206,13 @@ ve.ce.MWBlockImageNode.prototype.updateSize = function ( dimensions ) {
} }
this.$image.css( dimensions ); this.$image.css( dimensions );
// Make sure $figure is sharing the dimensions, otherwise 'middle' and 'none'
// positions don't work properly
this.$figure.css( {
'width': dimensions.width + ( this.captionVisible ? 2 : 0 ),
'height': this.captionVisible ? 'auto' : dimensions.height
} );
this.$figure.toggleClass( 'mw-default-size', !!this.model.getAttribute( 'defaultSize' ) ); this.$figure.toggleClass( 'mw-default-size', !!this.model.getAttribute( 'defaultSize' ) );
}; };