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

feat(image): add aspect ratio option #3205

Merged
merged 9 commits into from
Jun 24, 2024
Merged

Conversation

Arukuen
Copy link
Contributor

@Arukuen Arukuen commented Jun 10, 2024

fixes #3200

Copy link

github-actions bot commented Jun 10, 2024

🤖 Pull request artifacts

file commit
pr3205-stackable-3205-merge.zip e383f3f

github-actions bot added a commit that referenced this pull request Jun 10, 2024
@Arukuen Arukuen marked this pull request as ready for review June 10, 2024 13:59
github-actions bot added a commit that referenced this pull request Jun 10, 2024
github-actions bot added a commit that referenced this pull request Jun 13, 2024
Comment on lines 211 to 213
setAttributes( { imageHeight: value } )
if ( attributes.imageAspectRatio !== '' && attributes.imageWidth === '' ) {
setAttributes( { imageWidth: 'auto' } )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to call setAttributes only once when a value changes. In the block editor, whenever setAttributes is called, it creates a new entry in the changes history, since it's called twice here, you'll have to undo two times.

github-actions bot added a commit that referenced this pull request Jun 15, 2024
github-actions bot added a commit that referenced this pull request Jun 19, 2024
@andeng1106
Copy link

@Arukuen Aspect Ratio setting is present for Card block but it doesn't follow any ratio, even when changing height.

Screen.Recording.2024-06-19.at.5.mp4

cc: @bfintal

@bfintal
Copy link
Contributor

bfintal commented Jun 20, 2024

For the card block, I would expect the Aspect Ratio to be present and should have an effect. So e.g. setting it to square should really make the image square

github-actions bot added a commit that referenced this pull request Jun 22, 2024
@Arukuen
Copy link
Contributor Author

Arukuen commented Jun 22, 2024

Fixed the aspect ratio for card block, specifically default and default-2 variations.

For variation horizontal, I think the aspect ratio option should be removed since the height is already dependent to the content of the card. For variation full and faded, I think it should also be removed since the dimensions of the image are dependent to the card itself like a background.

github-actions bot added a commit that referenced this pull request Jun 24, 2024
@bfintal bfintal merged commit 11b33ae into develop Jun 24, 2024
1 of 6 checks passed
@bfintal bfintal deleted the feat/3200-image-aspect-ratio branch June 24, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add aspect ratio option to Image Block
3 participants