Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command to navigate to site editor #66722

Merged
13 changes: 12 additions & 1 deletion packages/editor/src/components/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,18 @@ function useEditorCommandLoader() {
},
} );
}

const isInSiteEditor =
window.location.pathname.includes( 'site-editor.php' );
benazeer-ben marked this conversation as resolved.
Show resolved Hide resolved
if ( ! isInSiteEditor ) {
commands.push( {
name: 'core/go-to-site-editor',
label: __( 'Open Site Editor' ),
callback: ( { close } ) => {
close();
window.location.href = '/wp-admin/site-editor.php';
benazeer-ben marked this conversation as resolved.
Show resolved Hide resolved
},
} );
}
return {
commands,
isLoading: false,
Expand Down
Loading