Make WordPress Core

Ticket #38532: 38532.3.diff

File 38532.3.diff, 6.9 KB (added by sirbrillig, 7 years ago)

Updated patch to include better icon positioning and width/height

  • src/wp-content/themes/twentyfourteen/style.css

    diff --git src/wp-content/themes/twentyfourteen/style.css src/wp-content/themes/twentyfourteen/style.css
    index 72b320f..d5c2c2f 100644
    span + .edit-link:before, 
    10451045        outline: 1px dotted;
    10461046}
    10471047
    1048 .secondary-navigation .customize-partial-edit-shortcut:before,
    1049 .footer-sidebar .widget:first-child .customize-partial-edit-shortcut:before {
     1048.secondary-navigation .customize-partial-edit-shortcut button,
     1049.footer-sidebar .widget:first-child .customize-partial-edit-shortcut button {
    10501050        left: 0;
    10511051}
    10521052
  • src/wp-content/themes/twentyseventeen/inc/color-patterns.php

    diff --git src/wp-content/themes/twentyseventeen/inc/color-patterns.php src/wp-content/themes/twentyseventeen/inc/color-patterns.php
    index d14e0b1..0a20a03 100644
    body.colors-custom, 
    317317.colors-custom .next.page-numbers:hover,
    318318.colors-custom .site-content .wp-playlist-light .wp-playlist-item:hover,
    319319.colors-custom .site-content .wp-playlist-light .wp-playlist-item:focus,
    320 .colors-custom .customize-partial-edit-shortcut:before {
     320.colors-custom .customize-partial-edit-shortcut button {
    321321        background: hsl( ' . esc_attr( $hue ) . ', ' . esc_attr( $saturation ) . ', 46% ); /* base: #767676; */
    322322}
    323323
  • src/wp-content/themes/twentyseventeen/style.css

    diff --git src/wp-content/themes/twentyseventeen/style.css src/wp-content/themes/twentyseventeen/style.css
    index b155cfa..fc0b5ea 100644
    object { 
    29752975}
    29762976
    29772977/* Add some space around the visual edit shortcut buttons. */
    2978 .twentyseventeen-panel .customize-partial-edit-shortcut:before {
     2978.twentyseventeen-panel .customize-partial-edit-shortcut button {
    29792979        top: 30px;
    29802980        left: 30px;
    29812981}
    object { 
    29912991}
    29922992
    29932993/* Prevent icon colors from clashing with color schemes. */
    2994 .colors-custom .customize-partial-edit-shortcut:before {
     2994.colors-custom .customize-partial-edit-shortcut button {
    29952995        text-shadow: 0 -1px 1px rgba(0,0,0,.2),
    29962996                     1px 0 1px rgba(0,0,0,.2),
    29972997                     0 1px 1px rgba(0,0,0,.2),
  • src/wp-includes/css/customize-preview.css

    diff --git src/wp-includes/css/customize-preview.css src/wp-includes/css/customize-preview.css
    index a388488..80636b0 100644
     
    1212}
    1313
    1414/* Make shortcut buttons essentially invisible */
    15 .widget button.customize-partial-edit-shortcut,
     15.widget .customize-partial-edit-shortcut,
    1616.customize-partial-edit-shortcut {
    17         position: relative;
     17        position: absolute;
    1818        float: left;
    1919        width: 1px; /* required to have a size to be focusable in Safari */
    2020        height: 1px;
     
    2828        z-index: 5;
    2929}
    3030
    31 .customize-partial-edit-shortcut:active {
     31.widget .customize-partial-edit-shortcut button:active,
     32.customize-partial-edit-shortcut button:active {
    3233        padding: 0;
    3334        border: 0;
    3435}
    3536
    3637/* Styles for the actual shortcut */
    37 .customize-partial-edit-shortcut:before {
     38.widget .customize-partial-edit-shortcut button,
     39.customize-partial-edit-shortcut button {
    3840        position: absolute;
    3941        left: -36px;
    4042        color: #fff;
    4143        width: 30px;
    4244        height: 30px;
     45        min-width: 30px;
     46        min-height: 30px;
    4347        font-size: 18px;
    44         font-family: dashicons;
    45         content: '\f464';
    4648        z-index: 5;
    4749        background-color: #0085ba;
     50        background: #0085ba;
    4851        border-radius: 50%;
    4952        border: 2px solid #fff;
    5053        box-shadow: 0 2px 1px rgba(46,68,83,0.15);
     
    6568                     -1px 0 1px #006799;
    6669}
    6770
    68 .customize-partial-edit-shortcut:hover:before,
    69 .customize-partial-edit-shortcut:focus:before {
     71.customize-partial-edit-shortcut button svg {
     72        fill: #fff;
     73        min-width: 20px;
     74        min-height: 20px;
     75}
     76
     77.customize-partial-edit-shortcut button:hover,
     78.customize-partial-edit-shortcut button:focus {
    7079    background: #008ec2; /* matches primary buttons */
    7180        border-color: #191e23; /* provides visual focus style with 4.5 contrast against background color */
    7281}
    7382
    74 body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut:before {
     83body.customize-partial-edit-shortcuts-shown .customize-partial-edit-shortcut button {
    7584        animation-name: customize-partial-edit-shortcut-bounce-appear;
    7685        pointer-events: auto;
    7786}
    78 body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut:before {
     87body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut button {
    7988        animation-name: customize-partial-edit-shortcut-bounce-disappear;
    8089        pointer-events: none;
    8190}
    8291
    83 body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:before {
     92body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut button {
    8493        animation-duration: 1.5s;
    8594        animation-delay: 0.4s;
    8695        animation-name: customize-partial-edit-shortcut-bounce-disappear;
    8796        pointer-events: none;
    8897}
    8998
    90 .page-sidebar-collapsed .customize-partial-edit-shortcut:before,
    91 .customize-partial-edit-shortcut-hidden:before {
     99.page-sidebar-collapsed .customize-partial-edit-shortcut button,
     100.customize-partial-edit-shortcut-hidden .customize-partial-edit-shortcut button {
    92101        visibility: hidden;
    93102}
    94103
    95 .customize-partial-edit-shortcut-left-margin:before {
     104.customize-partial-edit-shortcut-left-margin .customize-partial-edit-shortcut button {
    96105        left: 0;
    97106}
    98107
    body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:bef 
    151160}
    152161
    153162@media screen and (max-width:800px) {
    154         .customize-partial-edit-shortcut:before {
     163        .customize-partial-edit-shortcut button {
    155164                left: -18px; /* Assume there will be less of a margin available on smaller screens */
    156165        }
    157166}
  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index 0fc06e9..d4523d9 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    214214                 * @return {jQuery} The edit shortcut button element.
    215215                 */
    216216                createEditShortcut: function() {
    217                         var partial = this, shortcutTitle;
     217                        var partial = this, shortcutTitle, $buttonContainer, $button, $image;
    218218                        shortcutTitle = partial.getEditShortcutTitle();
    219                         return $( '<button>', {
     219                        $buttonContainer = $( '<span>', {
     220                                'class': 'customize-partial-edit-shortcut ' + partial.getEditShortcutClassName()
     221                        } );
     222                        $button = $( '<button>', {
    220223                                'aria-label': shortcutTitle,
    221224                                'title': shortcutTitle,
    222                                 'type': 'button',
    223                                 'class': 'customize-partial-edit-shortcut ' + partial.getEditShortcutClassName()
     225                                'class': 'customize-partial-edit-shortcut-button'
    224226                        } );
     227                        $image = $( '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M13.89 3.39l2.71 2.72c.46.46.42 1.24.03 1.64l-8.01 8.02-5.56 1.16 1.16-5.58s7.6-7.63 7.99-8.03c.39-.39 1.22-.39 1.68.07zm-2.73 2.79l-5.59 5.61 1.11 1.11 5.54-5.65zm-2.97 8.23l5.58-5.6-1.07-1.08-5.59 5.6z"/></svg>' );
     228                        $button.append( $image );
     229                        $buttonContainer.append( $button );
     230                        return $buttonContainer;
    225231                },
    226232
    227233                /**