Make WordPress Core

Ticket #26642: 26642.9.diff

File 26642.9.diff, 3.8 KB (added by obenland, 11 years ago)
  • src/wp-includes/class-wp-editor.php

     
    333333                                        'preview_styles' => 'font-family font-size font-weight font-style text-decoration text-transform',
    334334
    335335                                        'wpeditimage_disable_captions' => $no_captions,
     336                                        'wpeditimage_html5_captions' => current_theme_supports( 'html5', 'caption' ),
    336337                                        'plugins' => implode( ',', $plugins ),
    337338                                );
    338339
     
    345346                                $dashicons = includes_url( "css/dashicons$suffix.css?$version" );
    346347                                $mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
    347348                                $wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
    348                                
     349
    349350                                // WordPress default stylesheet and dashicons
    350351                                $mce_css = array(
    351352                                        $dashicons,
  • src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

     
    303303                        bodyClass.push('rtl');
    304304                }
    305305
     306                if ( editor.getParam( 'wpeditimage_html5_captions' ) ) {
     307                        bodyClass.push( 'html5-caption' );
     308                }
     309
    306310                if ( env.ie ) {
    307311                        if ( parseInt( env.ie, 10 ) === 9 ) {
    308312                                bodyClass.push('ie9');
  • src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

     
    4747                                return c;
    4848                        }
    4949
    50                         width = parseInt( w, 10 ) + 10;
     50                        width = parseInt( w, 10 );
     51                        if ( ! editor.getParam( 'wpeditimage_html5_captions' ) ) {
     52                                width = width + 10;
     53                        }
    5154
    5255                        return '<div class="mceTemp"><dl id="'+ id +'" class="wp-caption '+ cls +'" style="width: '+ width +'px">' +
    5356                                '<dt class="wp-caption-dt">'+ img +'</dt><dd class="wp-caption-dd">'+ cap +'</dd></dl></div>';
     
    618621
    619622                        // Remove toolbar to avoid an orphaned toolbar when dragging an image to a new location
    620623                        removeToolbar();
    621 
    622624                });
    623625
    624626                // Prevent IE11 from making dl.wp-caption resizable
  • src/wp-includes/js/tinymce/skins/wordpress/wp-content.css

     
    4040        margin: 10px 0;
    4141}
    4242
     43.html5-caption .wp-caption {
     44        padding: 4px;
     45}
     46
    4347.mceIEcenter {
    4448        text-align: center;
    4549}
  • src/wp-includes/media.php

     
    765765        if ( ! empty( $atts['id'] ) )
    766766                $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" ';
    767767
     768        $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
     769
     770        if ( current_theme_supports( 'html5', 'caption' ) ) {
     771                return '<figure ' . $atts['id'] . 'style="width: ' . $atts['width'] . 'px;" class="' . esc_attr( $class ) . '">'
     772                . do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
     773        }
     774
    768775        $caption_width = 10 + $atts['width'];
    769776
    770777        /**
     
    788795        if ( $caption_width )
    789796                $style = 'style="width: ' . (int) $caption_width . 'px" ';
    790797
    791         $class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
    792 
    793798        return '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
    794799        . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
    795800}