Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/wp-includes/admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -935,9 +935,9 @@ function wp_admin_bar_edit_menu( $wp_admin_bar ) {
}

/**
* Adds the command palette trigger button.
* Adds a link to open the command palette.
*
* Displays a button in the admin bar that shows the keyboard shortcut
* Displays a link in the admin bar that shows the keyboard shortcut
* for opening the command palette.
*
* @since 7.0.0
Expand All @@ -959,12 +959,14 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void {
/* translators: Hidden accessibility text. */
__( 'Open command palette' ),
);

$wp_admin_bar->add_node(
array(
'id' => 'command-palette',
'title' => $title,
'href' => '#',
'meta' => array(
'parent' => 'top-secondary',
'id' => 'command-palette',
'title' => $title,
'href' => '#',
'meta' => array(
'class' => 'hide-if-no-js',
'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;',
),
Expand Down
4 changes: 1 addition & 3 deletions src/wp-includes/class-wp-admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ public function add_menus() {
add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 9991 );
add_action( 'admin_bar_menu', 'wp_admin_bar_recovery_mode_menu', 9992 );
add_action( 'admin_bar_menu', 'wp_admin_bar_search_menu', 9999 );
add_action( 'admin_bar_menu', 'wp_admin_bar_command_palette_menu', 9999 );
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is separate from the Search node in case someone wants to disable one and keep the other, but it is set at the same priority.


// Site-related.
add_action( 'admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0 );
Expand All @@ -661,9 +662,6 @@ public function add_menus() {
add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 );

// Command palette.
add_action( 'admin_bar_menu', 'wp_admin_bar_command_palette_menu', 55 );

// Content-related.
if ( ! is_network_admin() && ! is_user_admin() ) {
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 );
Expand Down
11 changes: 9 additions & 2 deletions src/wp-includes/css/admin-bar.css
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,14 @@ html:lang(he-il) .rtl #wpadminbar * {
* Command Palette
*/
#wpadminbar #wp-admin-bar-command-palette .ab-icon {
display: none; /* Icon displayed only on mobile */
margin: 0;
}

#wpadminbar #wp-admin-bar-command-palette .ab-icon:before {
content: "\f179";
content: "\f179" / '';
top: 2px;
left: -2px;
}

#wpadminbar #wp-admin-bar-command-palette kbd {
Expand Down Expand Up @@ -886,7 +888,8 @@ html:lang(he-il) .rtl #wpadminbar * {
#wpadminbar #wp-admin-bar-site-editor > .ab-item,
#wpadminbar #wp-admin-bar-customize > .ab-item,
#wpadminbar #wp-admin-bar-edit > .ab-item,
#wpadminbar #wp-admin-bar-my-account > .ab-item {
#wpadminbar #wp-admin-bar-my-account > .ab-item,
#wpadminbar #wp-admin-bar-command-palette > .ab-item {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
Expand Down Expand Up @@ -920,6 +923,10 @@ html:lang(he-il) .rtl #wpadminbar * {
-moz-osx-font-smoothing: grayscale;
}

#wpadminbar #wp-admin-bar-command-palette .ab-icon:before {
left: 0;
}

#wpadminbar #wp-admin-bar-appearance {
margin-top: 0;
}
Expand Down
Loading