Skip to content

Commit

Permalink
Shadow: Update shadow support to allow explicit skipping of serializa…
Browse files Browse the repository at this point in the history
…tion (#58306)

* use border serialization key for shadow

* update the structure of shadow support

* update block.json

* Update core blocks doc after rebase

---------

Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com>
  • Loading branch information
madhusudhand and aaronrobertshaw committed Feb 5, 2024
1 parent 57f67dc commit d2d6c71
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Prompt visitors to take action with a button-style link. ([Source](https://githu
- **Name:** core/button
- **Category:** design
- **Parent:** core/buttons
- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), shadow, spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~
- **Supports:** anchor, color (background, gradients, text), interactivity (clientNavigation), shadow (), spacing (padding), typography (fontSize, lineHeight), ~~alignWide~~, ~~align~~, ~~reusable~~
- **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, tagName, text, textAlign, textColor, title, type, url, width

## Buttons
Expand Down
4 changes: 3 additions & 1 deletion packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ const skipSerializationPathsEdit = {
[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
SPACING_SUPPORT_KEY,
],
[ `${ SHADOW_SUPPORT_KEY }` ]: [ SHADOW_SUPPORT_KEY ],
[ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
SHADOW_SUPPORT_KEY,
],
};

/**
Expand Down
4 changes: 3 additions & 1 deletion packages/block-library/src/button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@
}
},
"reusable": false,
"shadow": true,
"shadow": {
"__experimentalSkipSerialization": true
},
"spacing": {
"__experimentalSkipSerialization": true,
"padding": [ "horizontal", "vertical" ],
Expand Down
10 changes: 8 additions & 2 deletions schemas/json/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,15 @@
}
},
"shadow": {
"type": "boolean",
"description": "Allow blocks to define a box shadow.",
"default": false
"oneOf": [
{
"type": "boolean"
},
{
"type": "object"
}
]
},
"typography": {
"type": "object",
Expand Down

0 comments on commit d2d6c71

Please sign in to comment.