Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Palette: Fix duplicate Patterns command #54133

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/core-commands/src/admin-navigation-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { useCommand } from '@wordpress/commands';
import { __ } from '@wordpress/i18n';
import { external, plus, symbol } from '@wordpress/icons';
import { plus, symbol } from '@wordpress/icons';
import { addQueryArgs, getPath } from '@wordpress/url';
import { privateApis as routerPrivateApis } from '@wordpress/router';

Expand Down Expand Up @@ -42,7 +42,8 @@ export function useAdminNavigationCommands() {
} );
useCommand( {
name: 'core/manage-reusable-blocks',
label: __( 'Open patterns' ),
label: __( 'Patterns' ),
icon: symbol,
callback: ( { close } ) => {
if ( isTemplatesAccessible && isBlockBasedTheme ) {
const args = {
Expand All @@ -58,6 +59,5 @@ export function useAdminNavigationCommands() {
document.location.href = 'edit.php?post_type=wp_block';
}
},
icon: isSiteEditor ? symbol : external,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Minor enhancement: I don't think this command is an "External" command, whether you are inside or outside the Site Editor.

} );
}
19 changes: 0 additions & 19 deletions packages/core-commands/src/site-editor-navigation-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
post,
page,
layout,
symbol,
symbolFilled,
styles,
navigation,
Expand Down Expand Up @@ -303,24 +302,6 @@ function useSiteEditorBasicNavigationCommands() {
},
} );

result.push( {
name: 'core/edit-site/open-patterns',
label: __( 'Patterns' ),
icon: symbol,
callback: ( { close } ) => {
const args = {
path: '/patterns',
};
const targetUrl = addQueryArgs( 'site-editor.php', args );
if ( isSiteEditor ) {
history.push( args );
} else {
document.location = targetUrl;
}
close();
},
} );

return result;
}, [ history, isSiteEditor, isTemplatesAccessible, isBlockBasedTheme ] );

Expand Down