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

add minHeightUnit to latest core/cover deprecation #28627

Merged
merged 4 commits into from
Feb 1, 2021
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
4 changes: 4 additions & 0 deletions packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Allow setting the `crossOrigin` attribute so the `useTransformImage` hook can use cross-origin sources ([#28255](https://github.com/WordPress/gutenberg/pull/28255/)).

### Bug Fixes

- Fix a regression where the Cover block migration would not work with custom units for `minHeight` ([#28627](https://github.com/WordPress/gutenberg/pull/28627))

## 2.27.0 (2020-12-17)

### Enhancement
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/cover/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ const deprecated = [
minHeight: {
type: 'number',
},
minHeightUnit: {
type: 'string',
},
gradient: {
type: 'string',
},
Expand Down
12 changes: 12 additions & 0 deletions packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,15 @@
</div>
</div>
<!-- /wp:cover -->
<!-- wp:cover {"url":"https://example.com/some-background-image.png","id":1933,"dimRatio":0,"focalPoint":{"x":"0.50","y":"0.40"},"minHeight":48,"minHeightUnit":"vw","align":"full"} -->
<div
class="wp-block-cover alignfull"
style="background-image: url( https://example.com/some-background-image.png ); min-height: 48vw; background-position: 50% 40%;"
>
<div class="wp-block-cover__inner-container">
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->
</div>
</div>
<!-- /wp:cover -->
36 changes: 36 additions & 0 deletions packages/e2e-tests/fixtures/blocks/core__cover__deprecated-6.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,41 @@
}
],
"originalContent": "<div\n\tclass=\"wp-block-cover has-background-dim-40 has-background-dim\"\n\tstyle=\"background-image:url(data:image/jpeg;base64,/9j/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/yQALCAABAAEBAREA/8wABgAQEAX/2gAIAQEAAD8A0s8g/9k=)\"\n>\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t\n\t</div>\n</div>"
},
{
"clientId": "_clientId_1",
"name": "core/cover",
"isValid": true,
"attributes": {
"url": "https://example.com/some-background-image.png",
"id": 1933,
"hasParallax": false,
"dimRatio": 0,
"backgroundType": "image",
"focalPoint": {
"x": "0.50",
"y": "0.40"
},
"title": "",
"contentAlign": "center",
"isRepeated": false,
"minHeight": 48,
"minHeightUnit": "vw",
"className": "alignfull"
},
"innerBlocks": [
{
"clientId": "_clientId_0",
"name": "core/paragraph",
"isValid": true,
"attributes": {
"content": "",
"dropCap": false
},
"innerBlocks": [],
"originalContent": "<p></p>"
}
],
"originalContent": "<div\n\tclass=\"wp-block-cover alignfull\"\n\tstyle=\"background-image: url( https://example.com/some-background-image.png ); min-height: 48vw; background-position: 50% 40%;\"\n>\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t\n\t</div>\n</div>"
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,47 @@
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n",
"innerContent": [
"\n"
]
},
{
"blockName": "core/cover",
"attrs": {
"url": "https://example.com/some-background-image.png",
"id": 1933,
"dimRatio": 0,
"focalPoint": {
"x": "0.50",
"y": "0.40"
},
"minHeight": 48,
"minHeightUnit": "vw",
"align": "full"
},
"innerBlocks": [
{
"blockName": "core/paragraph",
"attrs": {},
"innerBlocks": [],
"innerHTML": "\n\t\t<p></p>\n\t\t",
"innerContent": [
"\n\t\t<p></p>\n\t\t"
]
}
],
"innerHTML": "\n<div\n\tclass=\"wp-block-cover alignfull\"\n\tstyle=\"background-image: url( https://example.com/some-background-image.png ); min-height: 48vw; background-position: 50% 40%;\"\n>\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t\n\t</div>\n</div>\n",
"innerContent": [
"\n<div\n\tclass=\"wp-block-cover alignfull\"\n\tstyle=\"background-image: url( https://example.com/some-background-image.png ); min-height: 48vw; background-position: 50% 40%;\"\n>\n\t<div class=\"wp-block-cover__inner-container\">\n\t\t",
null,
"\n\t</div>\n</div>\n"
]
},
{
"blockName": null,
"attrs": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
</p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->

<!-- wp:cover {"url":"https://example.com/some-background-image.png","id":1933,"dimRatio":0,"focalPoint":{"x":"0.50","y":"0.40"},"minHeight":48,"minHeightUnit":"vw","className":"alignfull"} -->
<div class="wp-block-cover alignfull" style="min-height:48vw"><img class="wp-block-cover__image-background wp-image-1933" alt="" src="https://example.com/some-background-image.png" style="object-position:50% 40%" data-object-fit="cover" data-object-position="50% 40%"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->