Skip to content

Commit

Permalink
Fix dimensions for unresized images
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jun 18, 2020
1 parent 232248f commit 06064ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/block-library/src/image/image-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export default function ImageEditor( {
naturalHeight,
width,
height,
clientWidth,
children,
} ) {
const { createErrorNotice } = useDispatch( 'core/notices' );
Expand Down Expand Up @@ -239,11 +240,11 @@ export default function ImageEditor( {
<div
className="richimage__crop-area"
style={ {
paddingBottom: `${
( 100 * naturalHeight ) / naturalWidth
}%`,
width,
height,
height:
height ||
( clientWidth * naturalHeight ) /
naturalWidth,
} }
>
<Cropper
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export default function Image( {
naturalHeight={ naturalHeight }
width={ width }
height={ height }
clientWidth={ clientWidth }
>
{ img }
</ImageEditor>
Expand Down

0 comments on commit 06064ce

Please sign in to comment.