diff options
author | Joe Dolson <joedolson@git.wordpress.org> | 2021-11-15 21:53:26 +0000 |
---|---|---|
committer | Joe Dolson <joedolson@git.wordpress.org> | 2021-11-15 21:53:26 +0000 |
commit | f58d8872b3ae0e7b23d297955d192f7f612088e5 (patch) | |
tree | 6e05d9ff7f7fe8cf8a72452f693144ce67b12be3 /src | |
parent | 2049f04b4d8115fd839d22d95f3b2394bab12d9a (diff) | |
download | wordpress-f58d8872b3ae0e7b23d297955d192f7f612088e5.tar.gz wordpress-f58d8872b3ae0e7b23d297955d192f7f612088e5.zip |
Media: Featured image modal loads only selected image.
Fix bug introduced in [50829] that caused media modal to only load the selected image. Executes `.more()` when loading the modal to ensure that the media collection is available.
Props manishamakhija, birgire, dilipbheda, afercia, hellofromTonya.
Fixes #42937.
git-svn-id: https://develop.svn.wordpress.org/trunk@52168 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src')
-rw-r--r-- | src/js/_enqueues/lib/ajax-response.js | 12 | ||||
-rw-r--r-- | src/wp-admin/includes/ajax-actions.php | 10 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/js/_enqueues/lib/ajax-response.js b/src/js/_enqueues/lib/ajax-response.js index 38816f3c38..659b91e023 100644 --- a/src/js/_enqueues/lib/ajax-response.js +++ b/src/js/_enqueues/lib/ajax-response.js @@ -18,7 +18,7 @@ window.wpAjax = jQuery.extend( { return r; }, parseAjaxResponse: function( x, r, e ) { // 1 = good, 0 = strange (bad data?), -1 = you lack permission. - var parsed = {}, re = jQuery('#' + r).empty(), err = ''; + var parsed = {}, re = jQuery('#' + r).empty(), err = '', successmsg = ''; if ( x && typeof x === 'object' && x.getElementsByTagName('wp_ajax') ) { parsed.responses = []; @@ -27,6 +27,7 @@ window.wpAjax = jQuery.extend( { var th = jQuery(this), child = jQuery(this.firstChild), response; response = { action: th.attr('action'), what: child.get(0).nodeName, id: child.attr('id'), oldId: child.attr('old_id'), position: child.attr('position') }; response.data = jQuery( 'response_data', child ).text(); + successmsg += response.data; response.supplemental = {}; if ( !jQuery( 'supplemental', child ).children().each( function() { response.supplemental[this.nodeName] = jQuery(this).text(); @@ -46,7 +47,14 @@ window.wpAjax = jQuery.extend( { } ).length ) { response.errors = false; } parsed.responses.push( response ); } ); - if ( err.length ) { re.html( '<div class="error">' + err + '</div>' ); } + if ( err.length ) { + re.html( '<div class="error">' + err + '</div>' ); + wp.a11y.speak( err ); + } else { + re.html( '<div class="updated notice is-dismissible"><p>' + successmsg + '</p></div>'); + jQuery(document).trigger( 'wp-updates-notice-added' ); + wp.a11y.speak( successmsg ); + } return parsed; } if ( isNaN(x) ) { return !re.html('<div class="error"><p>' + x + '</p></div>'); } diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 1ba480f2f1..191e5b54dd 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -1102,9 +1102,19 @@ function wp_ajax_add_tag() { $wp_list_table->single_row( $tag ); $parents = ob_get_clean(); + require ABSPATH . 'wp-admin/includes/edit-tag-messages.php'; + + $message = ''; + if ( isset( $messages[ $tax->name ][1] ) ) { + $message = $messages[ $tax->name ][1]; + } elseif ( isset( $messages['_item'][1] ) ) { + $message = $messages['_item'][1]; + } + $x->add( array( 'what' => 'taxonomy', + 'data' => $message, 'supplemental' => compact( 'parents', 'noparents' ), ) ); |