Media: Hide sidebar in Create Gallery when no actions available.

Check whether the media frame menu has action items. If not, hide the sidebar. Prevents showing a sidebar that looks interactive but contains no controls that are interactive. When in Create Gallery mode, the only action available is 'Create Gallery', and it is always active.

Props ukdrahul, ababir, ruchirj, nhrrob, joedolson, shailu25, mukesh27, sudipatel007, dhrumilk.
Fixes #60666.
Built from https://develop.svn.wordpress.org/trunk@59139


git-svn-id: http://core.svn.wordpress.org/trunk@58535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2024-09-30 22:22:17 +00:00
parent df3ba33621
commit 0768f8071b
3 changed files with 6 additions and 8 deletions

View File

@ -2282,17 +2282,15 @@ 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, view,
actionMenuLength, actionMenuItems = this.frame.menu.get('views'),
view; actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0;
if ( this.frame.menu ) { if ( this.frame.menu ) {
actionMenuItems = this.frame.menu.get('views'),
actionMenuLength = actionMenuItems ? actionMenuItems.views.get().length : 0,
// Show action menu only if it is active and has more than one default element. // Show action menu only if it is active and has more than one default element.
this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 ); this.frame.$el.toggleClass( 'hide-menu', ! mode || actionMenuLength < 2 );
} }
if ( ! mode ) { if ( ! mode || actionMenuLength < 2 ) {
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.7-alpha-59138'; $wp_version = '6.7-alpha-59139';
/** /**
* 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.