Skip to content

Commit

Permalink
Command palette: rename (#52153)
Browse files Browse the repository at this point in the history
* Revise use of “command menu” to “command palette”.

Dropping "global" where it was used as well.

* Find “command center” and replace with “command palette”
  • Loading branch information
stokesman authored Jul 3, 2023
1 parent 4090d21 commit a3d81f6
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ _Type_

### useCommand

Attach a command to the Global command menu.
Attach a command to the command palette.

_Parameters_

- _command_ `import('../store/actions').WPCommandConfig`: command config.

### useCommandLoader

Attach a command loader to the Global command menu.
Attach a command loader to the command palette.

_Parameters_

Expand Down
6 changes: 3 additions & 3 deletions packages/commands/src/components/command-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function CommandMenu() {
registerShortcut( {
name: 'core/commands',
category: 'global',
description: __( 'Open the global command menu' ),
description: __( 'Open the command palette' ),
keyCombination: {
modifier: 'primary',
character: 'k',
Expand Down Expand Up @@ -192,7 +192,7 @@ export function CommandMenu() {
};

useEffect( () => {
// Focus the command menu input when mounting the modal.
// Focus the command palette input when mounting the modal.
if ( isOpen ) {
commandMenuInput.current.focus();
}
Expand All @@ -211,7 +211,7 @@ export function CommandMenu() {
__experimentalHideHeader
>
<div className="commands-command-menu__container">
<Command label={ __( 'Global Command Menu' ) }>
<Command label={ __( 'Command palette' ) }>
<div className="commands-command-menu__header">
<Command.Input
ref={ commandMenuInput }
Expand Down
2 changes: 1 addition & 1 deletion packages/commands/src/hooks/use-command-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { store as commandsStore } from '../store';
import { unlock } from '../lock-unlock';

/**
* Sets the active context of the command center
* Sets the active context of the command palette
*
* @param {string} context Context to set.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/commands/src/hooks/use-command-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useDispatch } from '@wordpress/data';
import { store as commandsStore } from '../store';

/**
* Attach a command loader to the Global command menu.
* Attach a command loader to the command palette.
*
* @param {import('../store/actions').WPCommandLoaderConfig} loader command loader config.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/commands/src/hooks/use-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useDispatch } from '@wordpress/data';
import { store as commandsStore } from '../store';

/**
* Attach a command to the Global command menu.
* Attach a command to the command palette.
*
* @param {import('../store/actions').WPCommandConfig} command command config.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/commands/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function unregisterCommandLoader( name ) {
}

/**
* Opens the command center.
* Opens the command palette.
*
* @return {Object} action.
*/
Expand All @@ -95,7 +95,7 @@ export function open() {
}

/**
* Closes the command center.
* Closes the command palette.
*
* @return {Object} action.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/commands/src/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function commandLoaders( state = {}, action ) {
}

/**
* Reducer returning the command center open state.
* Reducer returning the command palette open state.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
Expand All @@ -82,7 +82,7 @@ function isOpen( state = false, action ) {
}

/**
* Reducer returning the command center's active context.
* Reducer returning the command palette's active context.
*
* @param {Object} state Current state.
* @param {Object} action Dispatched action.
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function Layout() {
headerAnimationState = canvasMode; // edit, view, init
}

// Sets the right context for the command center
// Sets the right context for the command palette
const commandContext =
canvasMode === 'edit' && isEditorPage
? 'site-editor-edit'
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/site-hub/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
className="edit-site-site-hub_toggle-command-center"
icon={ search }
onClick={ () => openCommandCenter() }
label={ __( 'Open command center' ) }
label={ __( 'Open command palette' ) }
/>
) }
</HStack>
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/specs/site-editor/command-center.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Site editor command center', () => {
test.describe( 'Site editor command palette', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'emptytheme' );
} );
Expand All @@ -17,11 +17,11 @@ test.describe( 'Site editor command center', () => {
await admin.visitSiteEditor();
} );

test( 'Open the command center and navigate to the page create page', async ( {
test( 'Open the command palette and navigate to the page create page', async ( {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Open command center' } )
.getByRole( 'button', { name: 'Open command palette' } )
.focus();
await page.keyboard.press( 'Meta+k' );
await page.keyboard.type( 'new page' );
Expand All @@ -36,11 +36,11 @@ test.describe( 'Site editor command center', () => {
).toBeVisible();
} );

test( 'Open the command center and navigate to a template', async ( {
test( 'Open the command palette and navigate to a template', async ( {
page,
} ) => {
await page
.getByRole( 'button', { name: 'Open command center' } )
.getByRole( 'button', { name: 'Open command palette' } )
.click();
await page.keyboard.type( 'index' );
await page.getByRole( 'option', { name: 'index' } ).click();
Expand Down

1 comment on commit a3d81f6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in a3d81f6.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5446469697
📝 Reported issues:

Please sign in to comment.