-
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
Page editor: double-click to edit template part #65024
Conversation
…`contentOnly` editing mode. Also tighten up the doubleclick handler that triggers the edit template modal. It should not trigger when clicking on template parts now that there's a second double click handler. Furthermore, let's stopImmediatePropagation if it's successful.
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: +264 B (+0.01%) Total Size: 1.78 MB
ℹ️ View Unchanged
|
This will need a code review but it's working for me :) Obviously it's separate but I think it would be good to try applying the same treatment to template parts when editing templates as well. |
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 testing great for me, I really like the change! 🎉
✅ Navigates correctly in the site editor when editing a page and double clicking the header or footer template parts
✅ Navigates correctly in the post editor when in template preview mode, and I'm able to successfully update the header and footer as needed
✅ When logged in as an Author and previewing the template, I cannot navigate to the template parts
I thought I ran into a bug where the Pattern modal kept displaying when editing a page in the site editor. It turns out it was because my page didn't have any content blocks, and the modal is really persistent about showing itself whenever you navigate to edit the page and there's no content. That isn't a blocker for this PR as I believe you're already looking at addressing the behaviour for that over in #65026
Here's where it kept showing the modal:
2024-09-05.14.21.43.mp4
Code-wise this is looking good to me. The only (very) tiny optimisation I could think of would be to move the callback into a useCallback
and pass it directly to onDoubleClick
as an attribute in TagName
(defaulting to undefined
if not available), so that we're not instantiating a new function every time, but in practice I'm not sure it'd make any real difference.
LGTM! 🚀
packages/editor/src/components/visual-editor/edit-template-blocks-notification.js
Outdated
Show resolved
Hide resolved
Cool to see this merged. I opened #65096 to discuss applying the same overall UX when template editing. |
(Possibly) Resolves #63305
What? How?
Note
This PR affects both the post and site editors when editing a post/page template. Should it be restricted to the site editor?
contentOnly
editing mode.Why?
Testing Instructions
Site Editor
Post Editor
For bonus points, log-in as an editor/author and ensure you can't do any of this.
Testing Instructions for Keyboard
Screenshots or screencast
Site editor
Kapture.2024-09-04.at.12.14.04.mp4
Post editor
Kapture.2024-09-04.at.12.31.29.mp4