diff --git a/packages/editor/src/components/commands/index.js b/packages/editor/src/components/commands/index.js index 381f07e681baeb..7bdb575f2b41af 100644 --- a/packages/editor/src/components/commands/index.js +++ b/packages/editor/src/components/commands/index.js @@ -9,6 +9,7 @@ import { drawerLeft, drawerRight, edit, + page, formatListBullets, listView, external, @@ -254,18 +255,6 @@ function useEditorCommandLoader() { } ); } - commands.push( { - name: 'core/drafts', - label: __( 'Pages/Drafts' ), - keywords: [ 'drafts' ], - icon: edit, - callback: ( { close } ) => { - close(); - window.location.href = - '/wp-admin/site-editor.php?postType=page&layout=list&activeView=drafts'; - }, - } ); - return { commands, isLoading: false, @@ -306,6 +295,26 @@ function useEditedEntityContextualCommands() { return { isLoading: false, commands }; } +function useSiteEditorCommandLoader() { + const commands = []; + commands.push( { + name: 'core/drafts', + label: __( 'Pages/Drafts' ), + keywords: [ 'drafts' ], + icon: page, + callback: ( { close } ) => { + close(); + window.location.href = + '/wp-admin/site-editor.php?postType=page&layout=list&activeView=drafts'; + }, + } ); + + return { + commands, + isLoading: false, + }; +} + export default function useCommands() { useCommandLoader( { name: 'core/editor/edit-ui', @@ -317,4 +326,10 @@ export default function useCommands() { hook: useEditedEntityContextualCommands, context: 'entity-edit', } ); + + useCommandLoader( { + name: 'core/editor/site-editor', + hook: useSiteEditorCommandLoader, + context: 'site-editor', + } ); }