-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Consolidate getBlockEditingMode to return 'contentOnly' or 'disabled' while in NavMode
#71119
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
Changes from 3 commits
1c59074
eb4c13c
321a478
fd1ab6b
29dbb0d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3051,26 +3051,22 @@ export const getBlockEditingMode = createRegistrySelector( | |
|
|
||
| const isNavMode = isNavigationMode( state ); | ||
|
|
||
| if ( isNavMode ) { | ||
| // If the editor *is* in navigation mode, the block editing mode states | ||
| // are stored in the derivedNavModeBlockEditingModes map. | ||
| return state.derivedNavModeBlockEditingModes?.has( clientId ) | ||
| ? state.derivedNavModeBlockEditingModes.get( clientId ) | ||
| : 'contentOnly'; | ||
|
||
| } | ||
|
|
||
| // If the editor is currently not in navigation mode, check if the clientId | ||
| // has an editing mode set in the regular derived map. | ||
| // There may be an editing mode set here for synced patterns or in zoomed out | ||
| // mode. | ||
| if ( | ||
| ! isNavMode && | ||
| state.derivedBlockEditingModes?.has( clientId ) | ||
| ) { | ||
| if ( state.derivedBlockEditingModes?.has( clientId ) ) { | ||
| return state.derivedBlockEditingModes.get( clientId ); | ||
| } | ||
|
|
||
| // If the editor *is* in navigation mode, the block editing mode states | ||
| // are stored in the derivedNavModeBlockEditingModes map. | ||
| if ( | ||
| isNavMode && | ||
| state.derivedNavModeBlockEditingModes?.has( clientId ) | ||
| ) { | ||
| return state.derivedNavModeBlockEditingModes.get( clientId ); | ||
| } | ||
|
|
||
| // In normal mode, consider that an explicitly set editing mode takes over. | ||
| const blockEditingMode = state.blockEditingModes.get( clientId ); | ||
| if ( blockEditingMode ) { | ||
|
|
||
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.
contentOnlyis also used outside of navigation (write) mode:contentOnlyThose all now have the inverted toolbar after this change, whereas my understanding is that it's only for navigation mode to indicate the different mode.
Before:

After:

Uh oh!
There was an error while loading. Please reload this page.
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 was my understanding that we'd surface if a block was contentOnly with the toolbar color, but maybe I misunderstood. @richtabor, can you clarify? I could go either way on if the toolbar should turn black or not if it's contentOnly. It'd be surprising to see the black toolbar, but also nice to have a visual indicator to know why the tools are missing.
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.
Ok, that's fine if so.
There might be some contrast issues to work out with the purple icon color (also not sure about the grey text color).