-
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
Fix Off Canvas Editor add submenu item option #46562
Conversation
Size Change: +29 B (0%) Total Size: 1.32 MB
ℹ️ View Unchanged
|
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.
I tested this and it worked as described.
Thank you for fixing ❤️
@@ -145,7 +144,7 @@ function ListViewBlock( { | |||
|
|||
const { isTreeGridMounted, expand, collapse } = useListViewContext(); | |||
|
|||
const isEditable = blockName !== 'core/page-list-item'; | |||
const isEditable = block.name !== 'core/page-list-item'; |
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.
Aside: I added this line to #46166
block.name === | ||
'core/navigation-submenu' | ||
) { | ||
const updateSelectionOnInsert = false; |
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.
Given the API this is very helpful 🙇
block.name === | ||
'core/navigation-submenu' |
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.
I added this to #46166
Thanks for fixing this. I had a hunch that the problem was that the block wasn't defined but I wasn't sure exactly what line was relying on that. Are you able to explain it? |
@scruffian The change in #46541 results in the off canvas editor using a slimmed down version of the block hierarchy that only has |
* Fix Off Canvas Editor add submenu item option * Fix comment
What?
Fixes #46553
Why?
This feature stopped working as a side effect of not passing the entire block data through the off canvas list view.
How?
Use a selector to get the block information from the block editor store.
I've also changed a minor aspect of how this feature works. It was originally creating a new submenu block every time, even when the block was already a submenu block. That's a little inefficient, as it'll result in the block getting a new client id.
If the block is already a submenu, it now only inserts a new navigation link.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Kapture.2022-12-15.at.11.41.38.mp4