Ticket #50322: 50322.diff
File 50322.diff, 3.4 KB (added by , 4 years ago) |
---|
-
src/js/_enqueues/admin/site-health.js
10 10 11 11 var __ = wp.i18n.__, 12 12 _n = wp.i18n._n, 13 sprintf = wp.i18n.sprintf; 13 sprintf = wp.i18n.sprintf, 14 data, 15 clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ), 16 isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length, 17 pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ), 18 successTimeout; 14 19 15 var data;16 var clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' );17 var isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length;18 var pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' );19 20 20 // Debug information copy section. 21 21 clipboard.on( 'success', function( e ) { 22 var $wrapper = $( e.trigger ).closest( 'div' );23 $( '.success', $wrapper ).addClass( 'visible');22 var triggerElement = $( e.trigger ), 23 successElement = $( '.success', triggerElement.closest( 'div' ) ); 24 24 25 wp.a11y.speak( __( 'Site information has been added to your clipboard.' ) ); 25 // Clear the selection and move focus back to the trigger. 26 e.clearSelection(); 27 // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680 28 triggerElement.focus(); 29 30 // Show success visual feedback. 31 clearTimeout( successTimeout ); 32 successElement.removeClass( 'hidden' ); 33 34 // Hide success visual feedback after 3 seconds since last success. 35 successTimeout = setTimeout( function() { 36 successElement.addClass( 'hidden' ); 37 }, 3000 ); 38 39 // Handle success audible feedback. 40 wp.a11y.speak( __( 'Site information has been copied to your clipboard.' ) ); 26 41 } ); 27 42 28 43 // Accordion handling in various areas. -
src/wp-admin/css/site-health.css
203 203 } 204 204 205 205 .site-health-copy-buttons .copy-button-wrapper { 206 display: inline-flex; 207 align-items: center; 206 208 margin: 0.5rem 0 1rem; 207 209 } 208 210 209 211 .site-health-copy-buttons .success { 210 display: none;211 212 color: #40860a; 212 line-height: 1.8;213 213 margin-left: 0.5rem; 214 214 } 215 215 216 .site-health-copy-buttons .success.visible {217 display: inline-block;218 height: 30px;219 line-height: 2.30769231;220 }221 222 216 .site-status-has-issues.hide { 223 217 display: none; 224 218 } … … 452 446 padding-bottom: 0; 453 447 font-weight: 600; 454 448 } 449 450 .wp-core-ui .site-health-copy-buttons .copy-button { 451 margin-bottom: 0; 452 } 455 453 } 456 454 457 455 /* The breakpoint is usually at 960px, the additional space is to allow for the margin. */ -
src/wp-admin/site-health-info.php
99 99 <button type="button" class="button copy-button" data-clipboard-text="<?php echo esc_attr( WP_Debug_Data::format( $info, 'debug' ) ); ?>"> 100 100 <?php _e( 'Copy site info to clipboard' ); ?> 101 101 </button> 102 <span class="success " aria-hidden="true"><?php _e( 'Copied!' ); ?></span>102 <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> 103 103 </div> 104 104 </div> 105 105