Ticket #26642: 26642.3.diff
File 26642.3.diff, 3.0 KB (added by , 11 years ago) |
---|
-
src/wp-includes/class-wp-editor.php
333 333 'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform', 334 334 335 335 'wpeditimage_disable_captions' => $no_captions, 336 'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ), 336 337 'plugins' => implode( ',', $plugins ), 337 338 ); 338 339 -
src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
2 2 tinymce.PluginManager.add( 'wpeditimage', function( editor ) { 3 3 function parseShortcode( content ) { 4 4 return content.replace( /(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function( a, b, c ) { 5 var id, cls, w, cap, img, width, 5 var id, cls, w, cap, img, width, style, 6 6 trim = tinymce.trim; 7 7 8 8 id = b.match( /id=['"]([^'"]*)['"] ?/ ); … … 47 47 return c; 48 48 } 49 49 50 width = parseInt( w, 10 ) + 10; 50 if ( editor.getParam( 'wpeditimage_html5_captions' ) ) { 51 style = ''; 52 } else { 53 width = parseInt( w, 10 ) + 10; 54 style = ' style="width: '+ width +'px"'; 55 } 51 56 52 return '<div class="mceTemp"><dl id="'+ id +'" class="wp-caption '+ cls +'" style="width: '+ width +'px">' +57 return '<div class="mceTemp"><dl id="'+ id +'" class="wp-caption '+ cls +'"'+ style +'>' + 53 58 '<dt class="wp-caption-dt">'+ img +'</dt><dd class="wp-caption-dd">'+ cap +'</dd></dl></div>'; 54 59 }); 55 60 } … … 619 624 620 625 // Remove toolbar to avoid an orphaned toolbar when dragging an image to a new location 621 626 removeToolbar(); 622 623 627 }); 624 628 625 629 // Prevent IE11 from making dl.wp-caption resizable -
src/wp-includes/media.php
720 720 if ( ! empty( $atts['id'] ) ) 721 721 $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; 722 722 723 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] ); 724 725 if ( current_theme_supports( 'html5', 'caption' ) ) { 726 return '<figure ' . $atts['id'] . 'class="' . esc_attr( $class ) . '">' 727 . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>'; 728 } 729 723 730 $caption_width = 10 + $atts['width']; 724 731 725 732 /** … … 743 750 if ( $caption_width ) 744 751 $style = 'style="width: ' . (int) $caption_width . 'px" '; 745 752 746 $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );747 748 753 return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">' 749 754 . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; 750 755 }