Skip to content

Commit e724755

Browse files
committed
wp-dev suggestions.
1 parent b1ff82d commit e724755

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/compat/wordpress-7.0/command-palette.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ function gutenberg_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ):
3030
* wp-i18n to be loaded as a dependency as it is most likely not included on the front
3131
* end of a site.
3232
*/
33-
$script = <<<'JS'
34-
(( shortcutLabels ) => {
33+
$function = <<<'JS'
34+
( shortcutLabels ) => {
3535
const isAppleOS = navigator.platform.startsWith("Mac") || navigator.platform === "iPhone" || navigator.platform === "iPad";
3636
if ( ! isAppleOS ) {
3737
return;
3838
}
3939
document.querySelector( '#wp-admin-bar-command-palette .ab-label kbd' ).textContent = shortcutLabels.appleOS;
40-
})
40+
}
4141
JS;
42-
$script .= '(' . wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');';
43-
$script .= "\n//# sourceURL=gutenberg_admin_bar_command_palette_menu";
42+
$script = sprintf( '( %s )( %s );', $function, wp_json_encode( $shortcut_labels, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) );
43+
$script .= "\n//# sourceURL=gutenberg_admin_bar_command_palette_menu";
4444
$wp_admin_bar->add_node(
4545
array(
4646
'id' => 'command-palette',

0 commit comments

Comments
 (0)