-
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
Editor: Unify the BlockContextualToolbar component between post and site editors #61104
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -700 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
isCollapsed, | ||
toggleCollapse, | ||
} ) { | ||
const blockToolbarRef = useRef(); |
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.
Good catch. The ref
had no actual use.
isCollapsed={ isBlockToolsCollapsed } | ||
blockSelectionStart={ blockSelectionStart } | ||
toggleCollapse={ handleToggleCollapse } | ||
onToggle={ handleToggleCollapse } |
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.
We can pass setIsBlockToolsCollapsed
here (like in edit-site
) and remove handleToggleCollapse
.
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.
Good catch.
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.
Thank you, @youknowriad!
Refactoring tests well for me ✅
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 think the name of the component should get changed, but otherwise this looks great! Glad to see them combined.
const { DocumentTools, PostViewLink, PreviewDropdown, PinnedItems, MoreMenu } = | ||
unlock( editorPrivateApis ); | ||
const { | ||
BlockContextualToolbar, |
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 know this is what I called it, but I'm not convinced of the name BlockContextualToolbar
. It's the <BlockToolbar />
, but allows it to be collapsed. Maybe it should be changed to <CollapsableBlockToolbar />
? Without the collapsing functionality, it's just a block toolbar.
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.
Sure works for me. It's going to be an internal component anyway, once we complete the unification of edit-post and edit-site, a lot of these private APIs won't be exported anymore.
a8b8911
to
45a14bb
Compare
Related #52632
What?
We're in a middle of an effort to merge the post and site editors under the @wordpress/editor abstraction. As part of this, this PR unifies the BlockContextualToolbar component between the post and site editors.
Testing Instructions
1- Enable Top Toolbar in both post and site editors
2- Ensure that it looks and behaves the same as trunk.
I did make some CSS shuffling so it would be good to check for potential CSS regressions.