-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Normalize the Navigation block appender behavior between canvas and list view contexts #71163
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 all commits
59b8295
f6ba618
2730503
ad16bd3
3385f0d
4358d61
6e47e86
3312dfc
eeef4e4
359a453
0f9d541
4e88985
8b58014
6c586aa
12c1f84
ccc9ad8
f4a47ea
c5b206c
05c9a62
5205281
aa509f4
b9cb6eb
12ceb1e
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 |
|---|---|---|
|
|
@@ -22,13 +22,20 @@ export const Appender = forwardRef( | |
| const { insertedBlock, setInsertedBlock } = useListViewContext(); | ||
|
|
||
| const instanceId = useInstanceId( Appender ); | ||
| const hideInserter = useSelect( | ||
| const { directInsert, hideInserter } = useSelect( | ||
| ( select ) => { | ||
| const { getTemplateLock, isZoomOut } = unlock( | ||
| select( blockEditorStore ) | ||
| ); | ||
| const { getBlockListSettings, getTemplateLock, isZoomOut } = | ||
| unlock( select( blockEditorStore ) ); | ||
|
|
||
| return !! getTemplateLock( clientId ) || isZoomOut(); | ||
| const settings = getBlockListSettings( clientId ); | ||
| const directInsertValue = settings?.directInsert || false; | ||
| const hideInserterValue = | ||
| !! getTemplateLock( clientId ) || isZoomOut(); | ||
|
|
||
| return { | ||
| directInsert: directInsertValue, | ||
| hideInserter: hideInserterValue, | ||
| }; | ||
| }, | ||
| [ clientId ] | ||
| ); | ||
|
|
@@ -79,7 +86,7 @@ export const Appender = forwardRef( | |
| position="bottom right" | ||
| isAppender | ||
| selectBlockOnInsert={ false } | ||
| shouldDirectInsert={ false } | ||
| shouldDirectInsert={ directInsert } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we don't have any instances where this is false anymore.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should mirror the block list settings. |
||
| __experimentalIsQuick | ||
| { ...props } | ||
| toggleProps={ { 'aria-describedby': descriptionId } } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,7 +146,6 @@ export default function LeafMoreMenu( props ) { | |
| <AddSubmenuItem | ||
| block={ block } | ||
| onClose={ onClose } | ||
| expanded | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The expanded prop was being passed to AddSubmenuItem but never actually used in the component. The function only uses expandedState and expand props for its logic. This was a cleanup to remove dead code that was likely leftover from an earlier implementation. |
||
| expandedState={ props.expandedState } | ||
| expand={ props.expand } | ||
| setInsertedBlock={ props.setInsertedBlock } | ||
|
|
||
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.
This will be backwards compat as the new object will still contain
clientId.