ve.ce.MWGalleryImageCaptionNode
var defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions;
var attributes = model.getAttributes();
var galleryMwAttrs = model.parent.getAttribute( 'mw' ).attrs;
// Putting all this setup in the constructor works because MWGalleryImageNodes are never updated,
// only created from scratch
// These dimensions are different depending on the gallery mode.
// (This only vaguely approximates the actual rendering.)
var mode = galleryMwAttrs.mode || defaults.mode;
var innerDivWidth, innerDivHeight, innerDivMargin, outerDivWidth;
if ( mode === 'traditional' || mode === 'nolines' || mode === 'slideshow' ) {
var imagePadding = ( mode === 'traditional' ? 30 : 0 );
innerDivWidth = parseInt( galleryMwAttrs.widths || defaults.imageWidth ) + imagePadding;
innerDivHeight = parseInt( galleryMwAttrs.heights || defaults.imageHeight ) + imagePadding;
if ( mode === 'traditional' ) {
var imageHeight = parseInt( attributes.height );
innerDivMargin = ( ( innerDivHeight - imageHeight ) / 2 ) + 'px auto';
} else {
innerDivMargin = 0;
}
outerDivWidth = innerDivWidth + 8;
} else {
innerDivWidth = parseInt( attributes.width );
innerDivHeight = parseInt( galleryMwAttrs.heights || defaults.imageHeight );
innerDivMargin = 0;
outerDivWidth = innerDivWidth + 4;
}
var resourceTitle = mw.Title.newFromText( mw.libs.ve.normalizeParsoidResourceName( attributes.resource ) );
this.$element
.addClass( 'gallerybox' )
.css( 'width', outerDivWidth + 'px' );
var $thumbDiv = $( '