Replace deprecated jQuery code in includes/emails/class-wc-email.php
This commit replaces a call to the now deprecated jQuery.fn.toggle(handler, handler...) (https://api.jquery.com/toggle-event/) with a jQuery.click(). The deprecated call was used in the page where admins can edit e-mail templates (example: wp-admin/admin.php?page=wc-settings&tab=email§ion=wc_email_customer_on_hold_order) to show or hide the contents of the template and at the same time change the label of the button. We are now using jQuery.click() with a if statement inside to decide which label to use.
This commit is contained in:
parent
3f61afe533
commit
05cc0882e5
|
@ -1048,11 +1048,14 @@ class WC_Email extends WC_Settings_API {
|
|||
var view = '" . esc_js( __( 'View template', 'woocommerce' ) ) . "';
|
||||
var hide = '" . esc_js( __( 'Hide template', 'woocommerce' ) ) . "';
|
||||
|
||||
jQuery( 'a.toggle_editor' ).text( view ).toggle( function() {
|
||||
jQuery( this ).text( hide ).closest(' .template' ).find( '.editor' ).slideToggle();
|
||||
return false;
|
||||
}, function() {
|
||||
jQuery( this ).text( view ).closest( '.template' ).find( '.editor' ).slideToggle();
|
||||
jQuery( 'a.toggle_editor' ).text( view ).click( function() {
|
||||
if ( jQuery( this ).closest(' .template' ).find( '.editor' ).is(':visible') ) {
|
||||
var label = view;
|
||||
} else {
|
||||
var label = hide;
|
||||
}
|
||||
|
||||
jQuery( this ).text( label ).closest(' .template' ).find( '.editor' ).slideToggle();
|
||||
return false;
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in New Issue