Skip to content

Commit

Permalink
Feedback changes
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Dec 19, 2024
1 parent 41f34a4 commit 805f315
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions packages/editor/src/components/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
},
} );

Expand All @@ -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(),
Expand All @@ -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',
} );
}

0 comments on commit 805f315

Please sign in to comment.