-
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
Refactor Selected Block Tools #55737
Conversation
Size Change: +23 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
return null; | ||
} | ||
|
||
if ( shouldShowBreadcrumb || shouldShowContextualToolbar ) { |
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.
Nit: We could reverse the polarity of this and return null, so that the main return isn't inside a conditional.
packages/block-editor/src/components/block-tools/use-selected-block-tool-props.js
Outdated
Show resolved
Hide resolved
…block-tool-props.js
38d6d01
to
a214300
Compare
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 is looking good.
What?
Simplifying the code for the Selected Block Tools.
Why?
The previously named
<SelectedBlockPopover />
was also handling the<EmptyBlockInserter />
, which is specific to when there is no block selected. The naming of having the<EmptyBlockInserter />
be inside of the<SelectedBlockPopover />
is confusing, and also does not need most of the computation from the<SelectedBlockPopover />
. Splitting it at the parent<BlockTools />
level allows for a simpler flow.This is also in anticipation of #54513, but is very useful outside of it. This also makes the large #54513 much easier to review by splitting this into a more isolated chunk.
How?
<SelectedBlockPopover />
into<SelectedBlockTools />
and<EmptyBlockInserter />
<SelectedBlockTools />
and<EmptyBlockInserter />
into a<useSelectedBlockToolProps />
hook.Big thanks to @ajlende who refactored this with me on #54513.
Testing Instructions
There should be no functional change.
Testing Instructions for Keyboard
Screenshots or screencast