Make WordPress Core

Ticket #45380: 45380.patch

File 45380.patch, 4.0 KB (added by laurelfulford, 7 years ago)
  • src/wp-content/themes/twentysixteen/css/blocks.css

     
    2525        font-style: italic;
    2626        line-height: 1.6153846154;
    2727        padding-top: 0.5384615385em;
     28        text-align: left;
    2829}
    2930
     31.rtl [class^="wp-block-"] figcaption {
     32        text-align: right;
     33}
     34
    3035/*--------------------------------------------------------------
    31362.0 Blocks - Common Blocks
    3237--------------------------------------------------------------*/
     
    3742        font-size: 5em;
    3843}
    3944
     45/* Image */
     46
     47@media screen and (min-width: 61.5625em) {
     48        body:not(.search-results) article:not(.type-page) .wp-block-image figcaption.below-entry-meta {
     49                clear: both;
     50                display: block;
     51                float: none;
     52                margin-right: 0;
     53                margin-left: -40%;
     54                max-width: 140%;
     55        }
     56
     57        body.rtl:not(.search-results) article:not(.type-page) .wp-block-image figcaption.below-entry-meta {
     58                margin-left: 0;
     59                margin-right: -40%;
     60        }
     61}
     62
    4063/* Gallery */
    4164
    4265.wp-block-gallery {
  • src/wp-content/themes/twentysixteen/css/editor-blocks.css

     
    262262        font-style: italic;
    263263        line-height: 1.6153846154;
    264264        padding-top: 0.5384615385em;
     265        text-align: left;
    265266}
    266267
     268.rtl [class^="wp-block-"] figcaption {
     269        text-align: right;
     270}
     271
    267272/*--------------------------------------------------------------
    2682733.0 Blocks - Common Blocks
    269274--------------------------------------------------------------*/
  • src/wp-content/themes/twentysixteen/js/functions.js

     
    148148                                entryFooterPos       = entryFooter.offset(),
    149149                                entryFooterPosBottom = entryFooterPos.top + ( entryFooter.height() + 28 ),
    150150                                caption              = element.closest( 'figure' ),
     151                                figcaption           = element.next( 'figcaption' ),
    151152                                newImg;
    152153
    153154                        // Add 'below-entry-meta' to elements below the entry meta.
     
    154155                        if ( elementPosTop > entryFooterPosBottom ) {
    155156
    156157                                // Check if full-size images and captions are larger than or equal to 840px.
    157                                 if ( 'img.size-full' === param ) {
     158                                if ( 'img.size-full' === param || '.wp-block-image img' === param ) {
    158159
    159160                                        // Create an image to find native image width of resized images (i.e. max-width: 100%).
    160161                                        newImg = new Image();
     
    161162                                        newImg.src = element.attr( 'src' );
    162163
    163164                                        $( newImg ).on( 'load.twentysixteen', function() {
    164                                                 if ( newImg.width >= 840  ) {
     165                                                if ( newImg.width >= 840 ) {
     166
     167                                                        // Check if an image in an image block has a width attribute; if its value is less than 840, return.
     168                                                        if ( '.wp-block-image img' === param && element.is( '[width]' ) && element.attr( 'width' ) < 840 ) {
     169                                                                return;
     170                                                        }
     171
    165172                                                        element.addClass( 'below-entry-meta' );
    166173
    167174                                                        if ( caption.hasClass( 'wp-caption' ) ) {
     
    168175                                                                caption.addClass( 'below-entry-meta' );
    169176                                                                caption.removeAttr( 'style' );
    170177                                                        }
     178
     179                                                        if ( figcaption ) {
     180                                                                figcaption.addClass( 'below-entry-meta' );
     181                                                        }
    171182                                                }
    172183                                        } );
    173184                                } else {
     
    190201                                resizeTimer = setTimeout( function() {
    191202                                        belowEntryMetaClass( 'img.size-full' );
    192203                                        belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' );
     204                                        belowEntryMetaClass( '.wp-block-image img' );
    193205                                }, 300 );
    194206                                onResizeARIA();
    195207                        } );
     
    196208
    197209                belowEntryMetaClass( 'img.size-full' );
    198210                belowEntryMetaClass( 'blockquote.alignleft, blockquote.alignright' );
     211                belowEntryMetaClass( '.wp-block-image img' );
    199212        } );
    200213} )( jQuery );