Media: Dismiss button not functional on upload errors.
Change the `onclick` attribute to a separate inlined script in the error message and improve the event attachment behavior. Props vivekawsm, mijotj, adamsilverstein, parthvataliya, adhun, sarathar, peterwilsoncc, sayedulsayem, chaion07, sppramodh, indirabiswas27, aishwarryapande, dhrumilk, manojmaharrshi, ugyensupport, imranhasanraaz, pkbhatt, shailu25, joedolson. Fixes #60074. Built from https://develop.svn.wordpress.org/trunk@59986 git-svn-id: http://core.svn.wordpress.org/trunk@59328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -112,10 +112,12 @@ if ( isset( $_REQUEST['post_id'] ) ) {
|
||||
|
||||
$id = media_handle_upload( 'async-upload', $post_id );
|
||||
if ( is_wp_error( $id ) ) {
|
||||
$message = sprintf(
|
||||
$button_unique_id = uniqid( 'dismiss-' );
|
||||
$message = sprintf(
|
||||
'%s <strong>%s</strong><br />%s',
|
||||
sprintf(
|
||||
'<button type="button" class="dismiss button-link" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">%s</button>',
|
||||
'<button type="button" id="%s" class="dismiss button-link">%s</button>',
|
||||
esc_attr( $button_unique_id ),
|
||||
__( 'Dismiss' )
|
||||
),
|
||||
sprintf(
|
||||
@@ -132,6 +134,7 @@ if ( is_wp_error( $id ) ) {
|
||||
'paragraph_wrap' => false,
|
||||
)
|
||||
);
|
||||
echo "<script>jQuery( 'button#{$button_unique_id}' ).on( 'click', function() {jQuery(this).parents('div.media-item').slideUp(200, function(){jQuery(this).remove();})});</script>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-beta2-59985';
|
||||
$wp_version = '6.8-beta2-59986';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user