Changeset 22554
- Timestamp:
- 11/13/2012 12:32:04 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/js/mce-view.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/mce-view.js
r22537 r22554 456 456 457 457 wp.media.string.image = function( attachment, props ) { 458 var classes, img, options, size ;458 var classes, img, options, size, shortcode, html; 459 459 460 460 props = _.defaults( props || {}, { … … 482 482 img.src = size.url; 483 483 484 // Update `img` classes. 485 if ( props.align ) 484 // Only assign the align class to the image if we're not printing 485 // a caption, since the alignment is sent to the shortcode. 486 if ( props.align && ! attachment.caption ) 486 487 classes.push( 'align' + props.align ); 487 488 … … 515 516 } 516 517 517 return wp.html.string( options ); 518 html = wp.html.string( options ); 519 520 // Generate the caption shortcode. 521 if ( attachment.caption ) { 522 shortcode = { 523 id: 'attachment_' + attachment.id, 524 width: img.width 525 }; 526 527 if ( props.align ) 528 shortcode.align = 'align' + props.align; 529 530 html = wp.shortcode.string({ 531 tag: 'caption', 532 attrs: shortcode, 533 content: html + ' ' + attachment.caption 534 }); 535 } 536 537 return html; 518 538 }; 519 539
Note: See TracChangeset
for help on using the changeset viewer.