-
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
Omit "design" controls from Cover block toolbar while in Write mode #66853
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. |
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.
There are three editing modes: default
, disabled
, and content-only
.
In my opinion, it's safer to check if the edit mode is default
than to check if the edit mode is contentOnly
.
If the edit mode is disabled, we shouldn't be able to select the block in the first place, but just to be safe, it's better to ensure that the controls aren't rendered even if the edit mode is disabled
,
This means that we should be able to reuse the existing hasNonContentControls
variable.
@t-hamano also added |
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.
While this works, I think the main idea of "write mode" is that it shouldn't be the responsibility of the block to adapt itself.
So instead of this, I wonder if we can instead "hide the slots" from the block toolbar like we do for zoom-out mode.
@youknowriad for zoom-out we are hiding all slots like { isDefaultEditingMode && (
<BlockControls.Slot
group="block"
className="block-editor-block-toolbar__slot"
/>
) } But if we do this then there will be one problem that where ever in current implementation for "Write Mode" toolbar controls are added to
Let me know your thoughts 🙇♂️ |
What's the reasoning for only hiding "block" toolbar controls but not the others? I think one thing that is clear is that we shouldn't be thinking about these issues (controls in write) in isolation. So how do we decide that a block toolbar makes sense or not in a block in a generic way? cc @richtabor curious about your thoughts as you created these issues. |
If you see image block toolbar controls, some of them are added only for "Write mode," like |
Yes, that makes sense, I'm just trying to understand what's the generic rule, we shouldn't have to implement specific checks like that for each block. We also need to think about third-party blocks and we shouldn't be forcing them to implement specific logic so I'm trying to see if there's a rule to be extracted or not. |
What?
Based on editor mode updating cover block toolbar controls.
Why?
closes #66823
How?
Testing Instructions
Screenshots or screencast
Screen.Recording.2024-11-08.at.11.01.18.mov