Skip to content

Commit 774c36e

Browse files
Update src/wp-includes/admin-bar.php
Co-authored-by: Weston Ruter <westonruter@gmail.com>
1 parent 2ac2997 commit 774c36e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-includes/admin-bar.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -969,16 +969,16 @@ function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void {
969969
* wp-i18n to be loaded as a dependency as it is most likely not included on the front
970970
* end of a site.
971971
*/
972-
$script = <<<'JS'
973-
(( shortcutLabels ) => {
972+
$function = <<<'JS'
973+
( shortcutLabels ) => {
974974
const isAppleOS = navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad";
975975
if ( ! isAppleOS ) {
976976
return;
977977
}
978978
document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS;
979-
})
979+
}
980980
JS;
981-
$script .= '(' . wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');';
981+
$script = sprintf( '( %s )( %s );', $function, wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) );
982982
$script .= "\n//# sourceURL=wp_admin_bar_command_palette_menu";
983983
$wp_admin_bar->add_node(
984984
array(

0 commit comments

Comments
 (0)