diff --git a/lib/compat/wordpress-7.0/command-palette.php b/lib/compat/wordpress-7.0/command-palette.php new file mode 100644 index 00000000000000..4bdb97dbe22ee2 --- /dev/null +++ b/lib/compat/wordpress-7.0/command-palette.php @@ -0,0 +1,81 @@ +%s %s', + $shortcut_label, + /* translators: Hidden accessibility text. */ + __( 'Open command palette' ), + ); + $wp_admin_bar->add_node( + array( + 'id' => 'command-palette', + 'title' => $title, + 'href' => '#', + 'meta' => array( + 'class' => 'hide-if-no-js', + 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', + ), + ) + ); +} +if ( has_action( 'admin_bar_menu', 'wp_admin_bar_command_palette_menu' ) ) { + remove_action( 'admin_bar_menu', 'wp_admin_bar_command_palette_menu', 55 ); +} +add_action( 'admin_bar_menu', 'gutenberg_admin_bar_command_palette_menu', 55 ); + +function gutenberg_add_admin_bar_styles() { + if ( ! is_admin_bar_showing() ) { + return; + } + $css = <<