Skip to content

Commit dbd527f

Browse files
committed
Try inline server-side version
1 parent 1622667 commit dbd527f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/wp-includes/admin-bar.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,20 +951,23 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void {
951951

952952
$is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' );
953953
$shortcut_label = $is_apple_os
954-
? _x( '⌘K', 'keyboard shortcut to open the command palette', 'gutenberg' )
955-
: _x( 'Ctrl+K', 'keyboard shortcut to open the command palette', 'gutenberg' );
954+
? _x( '⌘K', 'keyboard shortcut to open the command palette' )
955+
: _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' );
956956
$title = sprintf(
957957
'<span class="ab-label"><kbd>%s</kbd><span class="screen-reader-text"> %s</span></span>',
958958
$shortcut_label,
959959
/* translators: Hidden accessibility text. */
960-
__( 'Open command palette', 'gutenberg' ),
960+
__( 'Open command palette' ),
961961
);
962962
$wp_admin_bar->add_node(
963963
array(
964964
'id' => 'command-palette',
965965
'title' => $title,
966966
'href' => '#',
967-
'meta' => array( 'class' => 'hide-if-no-js' ),
967+
'meta' => array(
968+
'class' => 'hide-if-no-js',
969+
'onclick' => 'if ( window.wp && wp.data && wp.data.dispatch ) { var store = wp.data.dispatch( "core/commands" ); if ( store && typeof store.open === "function" ) { store.open(); } } return false;',
970+
),
968971
)
969972
);
970973
}

0 commit comments

Comments
 (0)