-
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
Template Parts: allow selection in page content focus mode #60010
Template Parts: allow selection in page content focus mode #60010
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: +921 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
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.
Working well in testing. Nice work! I think its an improvement and finds a better balance whilst still locking templates which aren't modified as much as site navigation. @richtabor you happy to start here?
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.
Nice, this feels pretty good to use to me @noisysocks, so feels like a good place to start IMO! A couple of minor details:
The test create a new page, edit template and toggle page template preview
appears to be failing expecting the Edit your template to edit this block
notice, so some of the e2es might need updating.
While this is testing nicely for me in the site editor's view of editing a page, in the post editor with template preview mode switched on, it's possible to select the header or footer, and they're visible in the list view, but there's no option to Edit, so it isn't really possible to do anything. In this case, if the blocks cannot be edited in the current context, what would the desired behaviour be?
2024-03-20.14.07.46.mp4
Nice work. When you're editing a page, this seems like a good flow. To clarify a hidden nuance here, which is related to editing of inline template parts as also discussed here: in this branch inline editing of template parts is still possible when you select a template in the site editor. So the main change here is for pages only, where now you can select the TP, but only edit it in isolation. Since we are already having a special case for pages, this seems okay to me, but would love also a gut-check from @richtabor. |
That's my understanding as well, and on point with my expectations of this effort.
I think the whole dotted lines fading in work needs revisiting. It's not quite landing right. |
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.
This is certainly a step forward.
I'd like to see further explorations on an inline focus/isolated view, rather than navigating to the disconnected view next.
Fixed 👍
Great catch @andrewserong. My read on the fix for this is that we should be reducing the number of differences between the site editor and the post editor. I know @youknowriad has been doing a lot in this area. So with that in mind in 34e9348 I moved the code that adds the Edit button to the Template Part toolbar from |
Nice stuff. I tested this in the site and post editors. Works well with theme template parts and custom template parts. Highlight color appears, for me, correctly on mouseover and on touch. I couldn't break it after the latest updates. 2024-03-21.12.10.19.mp4🚢 |
I fixed this in 19516d7 by disabling appending when a template part is set to |
OK think I've fixed these in b0b35da. Thanks @jameskoster. Feel free to push more CSS tweaks if I missed something. |
What do you mean by root padding?
I don't think we currently have a double click shortcut for template parts? Or at least locally in
Good question. Right now one would have to switch to the post editor if there's no Post Title block. It could be worth exploring allowing the title to be set in one of the sidebars (black W sidebar on left, or page sidebar on right). It's beyond the scope of this PR though. |
Thanks everyone! I've addressed / responded to all feedback. I'll merge once there's an approving code review. |
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.
Just gave this a re-test and it's still all working nicely for me in the post and site editors 👍
The code change is also looking good to me, and seems consistent with the feedback that Riad gave in reviews, too, with relevant code moved over to the template part block where possible.
LGTM! ✨
Thank you! That'd be great.
Ah gotcha. I'm not sure. Personally I don't really like that dialog at all 😅 I think it would be unexpected if double clicking a template part behaved differently to double clicking a different block. Maybe the designers in this thread can weigh in on what we should do here. I can address it in a follow up if need be. |
@noisysocks, one of the e2e tests became flaky after this got merged into the trunk - #60102. Update: Here's my attempt to fix it - #60109. |
|
You can also disable "template previewing" from the "template panel" in the sidebar and you'll be thrown into the regular "post only" mode that does have a "title" input (like the post editor) |
…60010) * Allow selecting template parts in page content focus mode * Show block name/icon in toolbar when editing mode is contentOnly * Only show page content blocks in PageContent sidebar section * Fix pages.spec.js * Improve clarify of if() * Move template part Edit button from @wordpress/edit-site to @wordpress/editor * Rendering mode should be 'all' in post editor when editing a template or template part * Revert "Rendering mode should be 'all' in post editor when editing a template or template part" This reverts commit 348889e. * Reset and remember rendering mode when navigating in post editor * Remove unsupported rendering mode from docs * Add 'Edit' button to Template Part block natively * Disable appending into a template part * Always show purple outline on template parts Co-authored-by: noisysocks <noisysocks@git.wordpress.org> Co-authored-by: SaxonF <saxonafletcher@git.wordpress.org> Co-authored-by: andrewserong <andrewserong@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org> Co-authored-by: bacoords <bacoords@git.wordpress.org>
What?
Allows Template Part blocks (Header and Footer) to be selected when editing a page in the site editor in page content focus mode.
Why?
See #59970 (comment).
How?
core/template-part
blocks tocontentOnly
, so that you can select it.core/template-part
blocks todisabled
, so that you're forced to click Edit in the toolbar.BlockToolbar
to show the block icon / block name on blocks that have acontentOnly
editing mode, so that you can see the name of the template part when you've selected it.Testing Instructions
Screenshots or screencast
Kapture.2024-03-20.at.11.57.38.mp4