Skip to content
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 and behaviors: Fix some warnings #52109

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/experimental/interactivity-api/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/
function gutenberg_block_update_interactive_view_script( $metadata ) {
if (
array_key_exists( 'name', $metadata ) &&
in_array( $metadata['name'], array( 'core/image' ), true ) &&
array_key_exists( 'file', $metadata ) &&
str_contains( $metadata['file'], 'build/block-library/blocks' )
) {
$metadata['viewScript'] = array( 'file:./view-interactivity.min.js' );
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ export default function Image( {
const ratio =
( aspectRatio && evalAspectRatio( aspectRatio ) ) ||
( width && height && width / height ) ||
naturalWidth / naturalHeight;
naturalWidth / naturalHeight ||
1;

const currentWidth = ! width && height ? height * ratio : width;
const currentHeight = ! height && width ? width / ratio : height;
Expand Down
Loading