Skip to content

Commit

Permalink
Add toolbar icon for crop mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlende committed Dec 14, 2021
1 parent 2d0a4dc commit 8c30ffd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-editor/src/components/image-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* WordPress dependencies
*/
import { ToolbarGroup, ToolbarItem } from '@wordpress/components';
import { Icon, crop } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -32,6 +34,9 @@ export default function ImageEditor( {
naturalWidth={ naturalWidth }
/>
<BlockControls group="alt">
<div className="image-editor__crop-toolbar-icon">
<Icon icon={ crop } label={ __( 'Crop' ) } />
</div>
<ToolbarGroup>
<ZoomDropdown />
<ToolbarItem>
Expand Down
11 changes: 11 additions & 0 deletions packages/block-editor/src/components/image-editor/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.image-editor__crop-toolbar-icon {
display: flex;
align-items: center;
padding: 6px 12px;
background-color: $gray-900;
color: $white;

svg {
fill: currentColor;
}
}
1 change: 1 addition & 0 deletions packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@import "./components/default-block-appender/style.scss";
@import "./components/duotone-control/style.scss";
@import "./components/font-appearance-control/style.scss";
@import "./components/image-editor/style.scss";
@import "./components/image-size-control/style.scss";
@import "./components/inner-blocks/style.scss";
@import "./components/inserter-list-item/style.scss";
Expand Down

0 comments on commit 8c30ffd

Please sign in to comment.