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

Update: Round position attributes on cover focal point save #19183

Merged
merged 1 commit into from Dec 18, 2019

Conversation

@jorgefilipecosta
Copy link
Member

jorgefilipecosta commented Dec 16, 2019

Description

As @mmtr noted in #18665 (comment), the rounding problem on the cover block was not totally fixed. During the save we should also round the value.
This PR fixes the problem and introduces the deprecation logic to keep current blocks valid.

How has this been tested?

On the master branch, I inserted a cover block with an image background.
I set the focal point coordinates to seven.
I checked on the code view that the background-position was "7.000000000000001%".
I saved the post.
I switched to this branch and reloaded the post.
I verified the block was still valid and in the code editor, I verified the background-position was now 7%.
I inserted another block with 7 as the focal point position and verified in the code editor that the position was 7%.

@glendaviesnz

This comment has been minimized.

Copy link
Contributor

glendaviesnz commented Dec 16, 2019

Tested this locally and can verify that it works as advertised for both existing saved block content with unrounded %s, and with new blocks.

@mmtr
mmtr approved these changes Dec 18, 2019
Copy link
Contributor

mmtr left a comment

Thanks for the fix @jorgefilipecosta! This works great on my tests, with both new and existing cover blocks.

@jorgefilipecosta jorgefilipecosta merged commit d4a1202 into master Dec 18, 2019
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@jorgefilipecosta jorgefilipecosta deleted the fix/cover-rounding-on-block-save branch Dec 18, 2019
@youknowriad youknowriad added this to the Gutenberg 7.2 milestone Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.