Skip to content

Commit

Permalink
Add manage all custom patterns command (WordPress#51845)
Browse files Browse the repository at this point in the history
* Add manage all custom patterns command

* reorganise with useAdminNavigationCommands
  • Loading branch information
ntsekouras authored and sethrubenstein committed Jul 13, 2023
1 parent dd23066 commit bcf2ed3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
import { useCommand } from '@wordpress/commands';
import { __ } from '@wordpress/i18n';
import { plus } from '@wordpress/icons';
import { external, plus } from '@wordpress/icons';

export function useAddPostTypeCommands() {
export function useAdminNavigationCommands() {
useCommand( {
name: 'core/add-new-post',
label: __( 'Add new post' ),
Expand All @@ -22,4 +22,12 @@ export function useAddPostTypeCommands() {
document.location.href = 'post-new.php?post_type=page';
},
} );
useCommand( {
name: 'core/manage-reusable-blocks',
label: __( 'Manage all custom patterns' ),
callback: () => {
document.location.href = 'edit.php?post_type=wp_block';
},
icon: external,
} );
}
4 changes: 2 additions & 2 deletions packages/core-commands/src/private-apis.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* Internal dependencies
*/
import { useAddPostTypeCommands } from './add-post-type-commands';
import { useAdminNavigationCommands } from './admin-navigation-commands';
import { useSiteEditorNavigationCommands } from './site-editor-navigation-commands';
import { lock } from './lock-unlock';

function useCommands() {
useAddPostTypeCommands();
useAdminNavigationCommands();
useSiteEditorNavigationCommands();
}

Expand Down

0 comments on commit bcf2ed3

Please sign in to comment.