-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Button Block: Use hook based border support (#30194)
Remove the custom border radius panel from the Button block's `edit()`, and opt that button into using the `__experimentalBorder` block-supports feature for border radius instead. Furthermore, enable border radius support for the Button block in `experimental-default-theme.json` in order to preserve the current user-facing behavior.
- Loading branch information
Showing
14 changed files
with
202 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -173,6 +173,11 @@ | |
"border": { | ||
"customRadius": false | ||
} | ||
}, | ||
"core/button": { | ||
"border": { | ||
"customRadius": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/e2e-tests/fixtures/blocks/core__button__border_radius__deprecated.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:button {"borderRadius":25} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link" style="border-radius:25px">My button</a></div> | ||
<!-- /wp:button --></div> |
27 changes: 27 additions & 0 deletions
27
packages/e2e-tests/fixtures/blocks/core__button__border_radius__deprecated.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[ | ||
{ | ||
"clientId": "_clientId_0", | ||
"name": "core/button", | ||
"isValid": true, | ||
"attributes": { | ||
"text": "My button", | ||
"style": { | ||
"border": { | ||
"radius": 25 | ||
} | ||
} | ||
}, | ||
"innerBlocks": [], | ||
"originalContent": "<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" style=\"border-radius:25px\">My button</a></div>" | ||
}, | ||
{ | ||
"clientId": "_clientId_1", | ||
"name": "core/freeform", | ||
"isValid": true, | ||
"attributes": { | ||
"content": "" | ||
}, | ||
"innerBlocks": [], | ||
"originalContent": "</div>" | ||
} | ||
] |
20 changes: 20 additions & 0 deletions
20
packages/e2e-tests/fixtures/blocks/core__button__border_radius__deprecated.parsed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"blockName": "core/button", | ||
"attrs": { | ||
"borderRadius": 25 | ||
}, | ||
"innerBlocks": [], | ||
"innerHTML": "\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" style=\"border-radius:25px\">My button</a></div>\n", | ||
"innerContent": [ | ||
"\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link\" style=\"border-radius:25px\">My button</a></div>\n" | ||
] | ||
}, | ||
{ | ||
"blockName": null, | ||
"attrs": {}, | ||
"innerBlocks": [], | ||
"innerHTML": "</div>", | ||
"innerContent": [ "</div>" ] | ||
} | ||
] |
5 changes: 5 additions & 0 deletions
5
packages/e2e-tests/fixtures/blocks/core__button__border_radius__deprecated.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!-- wp:button {"style":{"border":{"radius":25}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link" style="border-radius:25px">My button</a></div> | ||
<!-- /wp:button --> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"borderRadius":0,"style":{"color":{"text":"#1b9b6c","background":"#aa5a20"}}} --> | ||
<!-- wp:button {"style":{"border":{"radius":0},"color":{"text":"#1b9b6c","background":"#aa5a20"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link no-border-radius has-text-color has-background" style="background-color:#aa5a20;color:#1b9b6c">My button</a></div> | ||
<!-- /wp:button --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/e2e-tests/fixtures/blocks/core__button__squared.serialized.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<!-- wp:button {"borderRadius":0,"style":{"color":{"text":"#1b9b6c","background":"#aa5a20"}}} --> | ||
<!-- wp:button {"style":{"border":{"radius":0},"color":{"text":"#1b9b6c","background":"#aa5a20"}}} --> | ||
<div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background no-border-radius" style="background-color:#aa5a20;color:#1b9b6c">My button</a></div> | ||
<!-- /wp:button --> |
Oops, something went wrong.