-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Image block: Normalize the block toolbar #29205
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
packages/block-editor/src/components/block-alignment-control/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockAlignmentUI from './ui'; | ||
|
||
export function BlockAlignmentControl( props ) { | ||
return <BlockAlignmentUI { ...props } isToolbar={ false } />; | ||
} | ||
|
||
export function BlockAlignmentToolbar( props ) { | ||
return <BlockAlignmentUI { ...props } isToolbar />; | ||
} |
2 changes: 1 addition & 1 deletion
2
...-toolbar/test/__snapshots__/index.js.snap → ...-control/test/__snapshots__/index.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import { menu } from '@wordpress/icons'; | |
* Internal dependencies | ||
*/ | ||
import Button from '../button'; | ||
import ToolbarButton from '../toolbar-button'; | ||
import Dropdown from '../dropdown'; | ||
import { NavigableMenu } from '../navigable-container'; | ||
|
||
|
@@ -49,6 +50,7 @@ function DropdownMenu( { | |
menuLabel, | ||
position, | ||
noIcons, | ||
isToolbarButton = false, | ||
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. Was this added for convenience? This can already be achieved with this code: <ToolbarItem>
{ ( toolbarItemProps ) => (
<DropdownMenu toggleProps={ toolbarItemProps } />
) }
</ToolbarItem> 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. TIL I guess I'll refactor these to avoid the prop :) |
||
} ) { | ||
if ( menuLabel ) { | ||
deprecated( '`menuLabel` prop in `DropdownComponent`', { | ||
|
@@ -84,6 +86,8 @@ function DropdownMenu( { | |
popoverProps | ||
); | ||
|
||
const ButtonComponent = isToolbarButton ? ToolbarButton : Button; | ||
|
||
return ( | ||
<Dropdown | ||
className={ classnames( 'components-dropdown-menu', className ) } | ||
|
@@ -113,7 +117,7 @@ function DropdownMenu( { | |
); | ||
|
||
return ( | ||
<Button | ||
<ButtonComponent | ||
{ ...mergedToggleProps } | ||
icon={ icon } | ||
onClick={ ( event ) => { | ||
|
@@ -135,7 +139,7 @@ function DropdownMenu( { | |
showTooltip={ toggleProps?.showTooltip ?? true } | ||
> | ||
{ mergedToggleProps.children } | ||
</Button> | ||
</ButtonComponent> | ||
); | ||
} } | ||
renderContent={ ( props ) => { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we plan to remove this once we transition?
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'm not sure we can, we have a valid use-case for it at the moment: The inspector control of the latest posts block. Also, it might have some impact on third party blocks.