Changeset 27668
- Timestamp:
- 03/24/2014 02:04:56 AM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-editor.php
r27660 r27668 340 340 341 341 'wpeditimage_disable_captions' => $no_captions, 342 'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ), 342 343 'plugins' => implode( ',', $plugins ), 343 344 ); -
trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
r27628 r27668 48 48 } 49 49 50 width = parseInt( w, 10 ) + 10; 50 width = parseInt( w, 10 ); 51 if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) { 52 width += 10; 53 } 51 54 52 55 return '<div class="mceTemp"><dl id="'+ id +'" class="wp-caption '+ cls +'" style="width: '+ width +'px">' + … … 190 193 html = createImageAndLink( imageData, 'html' ); 191 194 192 width = imageData.width + 10; 195 width = parseInt( imageData.width ); 196 197 if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) { 198 width += 10; 199 } 200 193 201 className = 'align' + imageData.align; 194 202 … … 391 399 editor.on( 'init', function() { 392 400 var dom = editor.dom; 401 402 if ( editor.getParam( 'wpeditimage_html5_captions' ) ) { 403 dom.addClass( editor.getBody(), 'html5-captions' ); 404 } 393 405 394 406 // Add caption field to the default image dialog … … 476 488 477 489 if ( data.width ) { 478 captionWidth = parseInt( data.width, 10 ) + 10; 479 captionWidth = ' style="width: '+ captionWidth +'px"'; 490 captionWidth = parseInt( data.width, 10 ); 491 492 if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) { 493 captionWidth += 10; 494 } 495 496 captionWidth = ' style="width: ' + captionWidth + 'px"'; 480 497 } 481 498 … … 540 557 541 558 if ( captionWidth ) { 542 captionWidth = parseInt( captionWidth, 10 ) + 10; 559 captionWidth = parseInt( captionWidth, 10 ); 560 561 if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) { 562 captionWidth += 10; 563 } 564 543 565 captionWidth = ' style="width: '+ captionWidth +'px"'; 544 566 } … … 619 641 // Remove toolbar to avoid an orphaned toolbar when dragging an image to a new location 620 642 removeToolbar(); 621 622 643 }); 623 644 … … 655 676 656 677 if ( width ) { 657 width = parseInt( width, 10 ) + 10; 678 width = parseInt( width, 10 ); 679 680 if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) { 681 width += 10; 682 } 683 658 684 editor.dom.setStyle( parent, 'width', width + 'px' ); 659 685 } -
trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
r27659 r27668 39 39 padding-top: 4px; 40 40 margin: 10px 0; 41 } 42 43 .html5-captions .wp-caption { 44 padding: 4px; 41 45 } 42 46 -
trunk/src/wp-includes/media.php
r27662 r27668 766 766 $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; 767 767 768 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); 769 770 if ( current_theme_supports( 'html5', 'caption' ) ) { 771 return '<figure ' . $atts['id'] . 'style="width: ' . (int) $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">' 772 . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; 773 } 774 768 775 $caption_width = 10 + $atts['width']; 769 776 … … 788 795 if ( $caption_width ) 789 796 $style = 'style="width: ' . (int) $caption_width . 'px" '; 790 791 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );792 797 793 798 return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
Note: See TracChangeset
for help on using the changeset viewer.