Skip to content

Commit

Permalink
Add manage all custom patterns command (#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 committed Jun 26, 2023
1 parent 74f3ce3 commit 67b5ebe
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

1 comment on commit 67b5ebe

@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 67b5ebe.
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/5375847791
📝 Reported issues:

Please sign in to comment.