-
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
Allow replace operation on empty default block in Zoom Out #68026
Allow replace operation on empty default block in Zoom Out #68026
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. |
Noting that I think we need to follow up with this to:
|
Size Change: -43 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
if ( isZoomOut() && operation !== 'insert' ) { | ||
const isTargetIndexEmptyDefaultBlock = | ||
operation === 'replace' && | ||
blocksData[ targetIndex ]?.isUnmodifiedDefaultBlock; |
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.
It's a bit confusing to read operation === 'replace' and later operation !== 'insert' and also why does the kind of operation determine if isTargetIndexEmptyDefaultBlock, as it feels the isUnmodifiedDefaultBlock flag should be enough.
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.
You know what I think we might be able to remove the operation
check like you suggest.
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.
✅ Does it work for you?
…#68026) * Allow replace operation on empty default block in Zoom Out * Remove operation type from conditional check Co-authored-by: getdave <[email protected]> Co-authored-by: draganescu <[email protected]>
…#68026) * Allow replace operation on empty default block in Zoom Out * Remove operation type from conditional check Co-authored-by: getdave <[email protected]> Co-authored-by: draganescu <[email protected]>
What?
Allows for drag and drop of Patterns in Zoom Out if the only block is an unmodified default block (normally
core/paragraph
).Fixes part of #67564
Why?
Currently on
trunk
when editing a Page in the Site Editor you can end up with a placeholdercore/paragraph
block in witin thecore/post-content
block.When in Zoom Out you drag and drop a Pattern onto this block there is no drop zone rendered.
This PR fixes that to show the drop zone. It also works if there is an unmodified default block anywhere within the block list which can happen if you click a pattern and insert into an empty page as the default block remains.
How?
Allows for a
replace
operation to be handled in Zoom Out but only if the block being replaced is an unmodified default block (i.e.core/paragraph
).This in turn allows the zoom out separator to be rendered.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Screen.Capture.on.2024-12-16.at.12-27-20.mp4