diff --git a/packages/editor/src/components/commands/index.js b/packages/editor/src/components/commands/index.js index 6446c473c741f0..815d05b4da6d1a 100644 --- a/packages/editor/src/components/commands/index.js +++ b/packages/editor/src/components/commands/index.js @@ -467,18 +467,41 @@ const getManipulateDocumentCommands = () => }; }; -const getuseSiteEditorCommandLoader = () => - function useSiteEditorCommandLoader() { +const getDataViewCommands = () => + function useDataViewCommands() { const commands = []; + commands.push( { - name: 'core/drafts', - label: __( 'Pages/Drafts' ), - keywords: [ 'drafts' ], - icon: page, + name: 'core/data-view/all-templates', + label: __( 'Manage templates' ), + keywords: [ 'templates', 'all templates' ], + icon: layout, callback: ( { close } ) => { close(); window.location.href = - '/wp-admin/site-editor.php?postType=page&layout=list&activeView=drafts'; + '/wp-admin/site-editor.php?p=%2Ftemplate'; + }, + } ); + + commands.push( { + name: 'core/data-view/all-pages', + label: __( 'Manage pages' ), + keywords: [ 'pages', 'all pages' ], + icon: page, + callback: ( { close } ) => { + close(); + window.location.href = '/wp-admin/site-editor.php?p=%2Fpage'; + }, + } ); + + commands.push( { + name: 'core/data-view/all-pages', + label: __( 'Manage Patterns' ), + keywords: [ 'patterns', 'template parts' ], + icon: page, + callback: ( { close } ) => { + close(); + window.location.href = '/wp-admin/site-editor.php?p=%2Fpattern'; }, } ); @@ -500,12 +523,6 @@ export default function useCommands() { context: 'entity-edit', } ); - useCommandLoader( { - name: 'core/editor/site-editor', - hook: getuseSiteEditorCommandLoader(), - context: 'site-editor', - } ); - useCommandLoader( { name: 'core/editor/page-content-focus', hook: getPageContentFocusCommands(), @@ -516,4 +533,10 @@ export default function useCommands() { name: 'core/edit-site/manipulate-document', hook: getManipulateDocumentCommands(), } ); + + useCommandLoader( { + name: 'core/editor/data-views', + hook: getDataViewCommands(), + context: 'data-views', + } ); }