-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: Styles: preview template to put focus on styles #67001
base: trunk
Are you sure you want to change the base?
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. |
Size Change: +199 B (+0.01%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
I'm happy to try it, though if @richtabor has time to chime in, I know he had reservations about aspects of this work. |
return { | ||
...settings, | ||
defaultRenderingMode: isGlobalStylesPreview | ||
? 'template-locked' |
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.
Template locked is a mode where you can edit the post things but not the template, so it's not the right thing here. For instance if you have a static page as front page, you'll still be able to edit its content.
I think instead of changing the rendering mode which is not meant to "lock" editing, we should just make sure that when isPreviewMode is on, you can't edit anything in the canvas. Maybe wrap the whole thing in inert=true
or something (we can check how we do it in "view" mode)
@@ -237,6 +248,7 @@ export default function EditSiteEditor( { isPostsList = false } ) { | |||
} | |||
customSavePanel={ _isPreviewingTheme && <SavePanel /> } | |||
forceDisableBlockTools={ ! hasDefaultEditorCanvasView } | |||
forceRemoveBlockTools={ isGlobalStylesPreview } |
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.
I'm not entirely sure this is needed either, I think we can probably remove all of these header tools when isPreviewMode
is true.
In the last commit, If I underhand properly, I believe what you did is to allow block selection while isPreviewMode is true. I understand the reasoning but I'm concerned about this change. Basically in some situations the
|
We could shelve this PR since it's no longer needed for #66951, we're no longer doing previews there. |
What?
When previewing the site through Site Editor > Styles, put the editor content in preview mode to focus on the styles rather than the content. Note that it is still possible to move on to template editing; if you double click the content you'll see a modal asking if you wish to edit the template.
Why?
When modifying global styles (through the Site Editor > Styles path), it seems beneficial to put the focus on styles rather than add all the complexities of styles AND template editing. If you edit both you might also have multiple entities to be saved.
Think about this as distraction free style editing, without the fear of changing other stuff.
This is an idea that came after working on #66951. We have use case there where the canvas is disabled when previewing static templates, so the props we add here are beneficial there as well.
How?
Whenever the path is active, disable block tools and lock the template. Double click still always you to edit it.
Testing Instructions
Go to Site Editor > Styles.
Testing Instructions for Keyboard
Screenshots or screencast