Skip to content

Commit

Permalink
add minHeightUnit to latest core/cover deprecation (#28627)
Browse files Browse the repository at this point in the history
Co-authored-by: Jon Surrell <[email protected]>
  • Loading branch information
2 people authored and noisysocks committed Feb 8, 2021
1 parent 9736549 commit c1fcffc
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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 -->

0 comments on commit c1fcffc

Please sign in to comment.