-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Hide Cut/Copy commands in Write Mode (contentOnly) #71063
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
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: +29 B (0%) Total Size: 1.91 MB
ℹ️ View Unchanged
|
Fixes issue where Cut/Copy/Paste commands were visible in Write Mode when they should be hidden. Write Mode is contentOnly mode where users should only see content-editing capabilities without structural controls. - Added isContentOnly condition to CopyMenuItem for Copy command - Added isContentOnly condition to CopyMenuItem for Cut command - Maintains existing behavior for other menu items
7fb3109 to
36dba23
Compare
- Update test to expect 4 menu items instead of 6 (Cut and Copy are hidden in Write Mode) - Rename isWriteMode to isContentOnlyWriteMode for better clarity - Fix indentation issues
scruffian
left a comment
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.
As discussed in the other PRs around write mode, I think we should consolidate this logic into one shared hook that we can use everywhere, but that can be a follow up :)
| openedBlockSettingsMenu: getOpenedBlockSettingsMenu(), | ||
| isContentOnly: | ||
| getBlockEditingMode( firstBlockClientId ) === 'contentOnly', | ||
| isNavigationMode: _isNavigationMode(), |
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.
Do we need this check? isContentOnly should only be true for any block when navigation mode is enabled.
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.
Container blocks can set editing mode outside the navigation using the templateLock. I guess it depends on whether to hide/show features based on only block editing mode or navigation mode.
Here's a case where both mode checks are needed - #70946.
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.
Hmm that feels like a bug, templateLock is a different thing from editingMode (or it should be).
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.
Yes, they're different, but both are setting block editing modes, which makes it hard to differentiate.
What
Fixes issue where Cut/Copy/Paste commands were visible in Write Mode when they should be hidden. Write Mode is contentOnly mode where users should only see content-editing capabilities without structural controls.
Why
When users are in Write Mode (contentOnly mode), they should only see content-editing capabilities without interference from structural/formatting controls. The Cut/Copy/Paste commands are structural controls that should be hidden in this mode to provide a cleaner, more focused editing experience.
How
Testing
Screenshots