Changeset 61912
- Timestamp:
- 03/10/2026 07:11:27 PM (3 weeks ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
-
admin-bar.php (modified) (1 diff)
-
class-wp-admin-bar.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/admin-bar.php
r60890 r61912 936 936 937 937 /** 938 * Adds the command palette trigger button. 939 * 940 * Displays a button in the admin bar that shows the keyboard shortcut 941 * for opening the command palette. 942 * 943 * @since 7.0.0 944 * 945 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. 946 */ 947 function wp_admin_bar_command_palette_menu( WP_Admin_Bar $wp_admin_bar ): void { 948 if ( ! is_admin() ) { 949 return; 950 } 951 952 $is_apple_os = (bool) preg_match( '/Macintosh|Mac OS X|Mac_PowerPC/i', $_SERVER['HTTP_USER_AGENT'] ?? '' ); 953 $shortcut_label = $is_apple_os 954 ? _x( '⌘K', 'keyboard shortcut to open the command palette' ) 955 : _x( 'Ctrl+K', 'keyboard shortcut to open the command palette' ); 956 $title = sprintf( 957 '<span class="ab-label"><kbd>%s</kbd><span class="screen-reader-text"> %s</span></span>', 958 $shortcut_label, 959 /* translators: Hidden accessibility text. */ 960 __( 'Open command palette' ), 961 ); 962 $wp_admin_bar->add_node( 963 array( 964 'id' => 'command-palette', 965 'title' => $title, 966 'href' => '#', 967 'meta' => array( 968 'class' => 'hide-if-no-js', 969 'onclick' => 'wp.data.dispatch( "core/commands" ).open(); return false;', 970 ), 971 ) 972 ); 973 } 974 975 /** 938 976 * Adds "Add New" menu. 939 977 * -
trunk/src/wp-includes/class-wp-admin-bar.php
r58748 r61912 662 662 add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 ); 663 663 664 // Command palette. 665 add_action( 'admin_bar_menu', 'wp_admin_bar_command_palette_menu', 55 ); 666 664 667 // Content-related. 665 668 if ( ! is_network_admin() && ! is_user_admin() ) {
Note: See TracChangeset
for help on using the changeset viewer.