Media: Prevent Media Library sidebar from showing with no actions.

Fix an issue where the actions sidebar in the media library could appear when there are no relevant actions available.

Props sruthi89, nithi22, ivanzhuck, dhruvishah2203, joemcgill, ukdrahul, joedolson, shailu25.
Fixes #58973.
Built from https://develop.svn.wordpress.org/trunk@57688


git-svn-id: http://core.svn.wordpress.org/trunk@57189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2024-02-21 19:46:08 +00:00
parent 5fd767d87d
commit 53f5646b75
3 changed files with 6 additions and 3 deletions

View File

@ -2282,9 +2282,12 @@ var State = Backbone.Model.extend(/** @lends wp.media.controller.State.prototype
_menu: function() { _menu: function() {
var menu = this.frame.menu, var menu = this.frame.menu,
mode = this.get('menu'), mode = this.get('menu'),
actionMenuItems = this.frame.menu.get('views'),
actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0,
view; view;
this.frame.$el.toggleClass( 'hide-menu', ! mode ); // Show action menu only if it is active and has more than one default element.
this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 );
if ( ! mode ) { if ( ! mode ) {
return; return;
} }

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-beta2-57687'; $wp_version = '6.5-beta2-57688';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.