-
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
Navigation: Add 'edit' to the block toolbar #45853
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Size Change: +91 B (0%) Total Size: 1.3 MB
ℹ️ View Unchanged
|
I tested and this doesn't seem to be working. Did all changes get pushed? |
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 works 🎉
Some feedback from a UX perspective which we can iterate on in followups.
- We should try and focus the
Menu
panel whenEdit
is clicked. - Having
Edit
remain active when the sidebar is open feels strange. Maybe it should be disabled? Something about the interaction doesn't feel right to me.
Overall though this now works well and avoids the pitfalls of the other approach.
I have some questions about string literals but I'd need to defer to others on whether the approach is valid or not.
We should get 👍 from @youknowriad before merging this one.
isPostEditor, | ||
} = useSelect( | ||
( select ) => { | ||
// eslint-disable-next-line @wordpress/data-no-store-string-literals |
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.
Is it ok to use string literals here then?
const openBlockInspector = () => { | ||
if ( isPostEditor ) { | ||
openGeneralSidebar( 'edit-post/block' ); | ||
} else { | ||
enableComplementaryArea( 'core/edit-site', 'edit-site/block-inspector' ); | ||
} | ||
}; |
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 feels like we should either have:
- normalized the structure of the editors
- create an abstraction to handle this kind of stuff
Not for this PR though...
@scruffian You should get 👍 from @youknowriad before merging this one. |
// We use this to determine which editor we are in so that | ||
// we can determine which inspector controls to open. | ||
const { | ||
isPostEditor, |
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's no need to test isPostEditor, we're always in post editor here, since this plugin is defined in edit-post
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.
In my testing, this was also running in the site editor.
f62d66e
to
532daa5
Compare
532daa5
to
9cbe8ac
Compare
What are the next steps here? |
I think we should probably start afresh. My current thinking is that we should change the list view button in the edit-side component to open the block inspector controls, and add the same thing to edit-post. |
Closing in favour of #46335 |
What?
This adds an "Edit" button the Block Toolbar for the navigation block, which opens the inspector controls.
Why?
An alternative to #45772.
How?
Adds a new plugin to the edit-post package and modifies the edit-site package.
Testing Instructions
Screenshots or screencast
TODO