Show error if copying can't even happen (to cover safari).
This commit is contained in:
parent
32eabbc685
commit
f4d771ef3e
|
@ -65,7 +65,13 @@
|
|||
}
|
||||
} );
|
||||
|
||||
$( document.body ).on( 'click', css_class, function( e ) {
|
||||
$( css_class ).parent().find( 'input' ).focus().select();
|
||||
$( '#copy-error' ).text( woocommerce_admin_api_keys.clipboard_failed );
|
||||
} );
|
||||
|
||||
$( document.body ).on( 'copy', css_class, function( e ) {
|
||||
$( '#copy-error' ).text( '' );
|
||||
e.clipboardData.clearData();
|
||||
e.clipboardData.setData( 'text/plain', $.trim( $( this ).prev( 'input' ).val() ) );
|
||||
e.preventDefault();
|
||||
|
|
|
@ -805,7 +805,14 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
});
|
||||
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
||||
$( document.body ).on ( 'click', '#copy-for-support', function( e ) {
|
||||
$( '#debug-report' ).find( 'textarea' ).focus().select();
|
||||
$( '#copy-error' ).text( '<?php esc_html_e( 'Copying to clipboard failed. Please press Ctrl/Cmd+C to copy.', 'woocommerce' ); ?>' );
|
||||
} );
|
||||
|
||||
$( document.body ).on( 'copy', '#copy-for-support', function( e ) {
|
||||
$( '#copy-error' ).text( '' );
|
||||
e.clipboardData.clearData();
|
||||
e.clipboardData.setData( 'text/plain', $( '#debug-report' ).find( 'textarea' ).val() );
|
||||
e.preventDefault();
|
||||
|
|
Loading…
Reference in New Issue