Skip to content

Commit

Permalink
Command Palette: Fix dupulicate Patterns command (#54133)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano authored Sep 5, 2023
1 parent 3dd64b6 commit 297999c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
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,
} );
}
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

0 comments on commit 297999c

Please sign in to comment.