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

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%.

@jorgefilipecosta jorgefilipecosta added [Type] Enhancement A suggestion for improvement. [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Dec 16, 2019
@glendaviesnz
Copy link
Contributor

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

Copy link
Contributor

@mmtr mmtr left a comment

Choose a reason for hiding this comment

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

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
@jorgefilipecosta jorgefilipecosta deleted the fix/cover-rounding-on-block-save branch December 18, 2019 18:55
@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
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants