-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
base: trunk
Are you sure you want to change the base?
Add command to navigate to site editor #66722
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @benazeer-ben! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
This works! testing.command.movWith that said, I wonder about the naming. Can we go with "Open the Site Editor" as that aligns with some of the "open" language outlined here #50407 ? I also am curious about the icon used and wonder if it should be something else: @WordPress/gutenberg-design for any quick thoughts on the icon! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
One thing to note here is that classic themes don't have access to the site editor root, so we can't add this command in classic themes.
Here's an example of code to detect if it's a block theme:
gutenberg/packages/edit-site/src/components/add-new-pattern/index.js
Lines 51 to 53 in 7ff7679
const { getCurrentTheme, getPostType, canUser } = select( coreStore ); | |
return { | |
isBlockBasedTheme: getCurrentTheme()?.is_block_theme, |
We could add a similar code to the existing useSelect hook.
Do we refer to the "Site Editor" anywhere else in the UI? I recognise it's a familiar term to wp community members, but otherwise we're introducing another name for the same thing. The wp-admin navigation refers to this section simply as "Editor" (under "Appearance"). The root panel is titled "Design".
I think the purpose is to go from the full screen editor (in either post or site editor) to the site editor root? This also suggests to me that the naming isn't quite right... "Site editor" means different things to different people. |
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
…o enhancement/add-command-go-to-site-editor
@benazeer-ben Thanks for the update! As mentioned in the comment, this command cannot be exposed to classic themes. Could you update this PR? One more thing I noticed is that the site editor is not accessible to all users. As implemented here, the command should only be exposed if the user can create templates and it is a block theme. |
Thanks for that suggestion @t-hamano Now the PR is updated with both the conditions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a code perspective, I think it's ready to ship, but should the phrase "Open Site Editor" be allowed? I don't think the Command Palette currently lets us set alias labels.
What?
Enhancement for the scenario mentioned in #61460
Why?
Currently there is no command option to go back to site editor from edit post or page views.
How?
Added command to navigate to Site Editor.
Testing Instructions
Screenshots or screencast
go-to-site-editor.mp4