From 642002e676bb0c2c8b464a1a620b7bcb32cb0d2b Mon Sep 17 00:00:00 2001 From: madhusudhand Date: Fri, 26 Jan 2024 17:33:37 +0530 Subject: [PATCH 1/4] use border serialization key for shadow --- packages/block-editor/src/hooks/style.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js index 52fd990a3cac44..f3689b7b742091 100644 --- a/packages/block-editor/src/hooks/style.js +++ b/packages/block-editor/src/hooks/style.js @@ -27,11 +27,7 @@ import { SPACING_SUPPORT_KEY, DimensionsPanel, } from './dimensions'; -import { - EFFECTS_SUPPORT_KEYS, - SHADOW_SUPPORT_KEY, - EffectsPanel, -} from './effects'; +import { EFFECTS_SUPPORT_KEYS, EffectsPanel } from './effects'; import { shouldSkipSerialization, useStyleOverride, @@ -103,7 +99,10 @@ function addAttribute( settings ) { * @type {Record} */ const skipSerializationPathsEdit = { - [ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ], + [ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ + 'border', + 'shadow', + ], [ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ COLOR_SUPPORT_KEY, ], @@ -116,7 +115,6 @@ const skipSerializationPathsEdit = { [ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ SPACING_SUPPORT_KEY, ], - [ `${ SHADOW_SUPPORT_KEY }` ]: [ SHADOW_SUPPORT_KEY ], }; /** From bc41460df0d33a9f3d461f4bc73a2cf397fc96ce Mon Sep 17 00:00:00 2001 From: madhusudhand Date: Wed, 31 Jan 2024 11:05:40 +0530 Subject: [PATCH 2/4] update the structure of shadow support --- docs/reference-guides/core-blocks.md | 22 ++++++++++---------- packages/block-editor/src/hooks/style.js | 14 ++++++++----- packages/block-library/src/button/block.json | 4 +++- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 35cecf6a27e663..9ec087d821cb14 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -61,7 +61,7 @@ Prompt visitors to take action with a group of button-style links. ([Source](htt - **Name:** core/buttons - **Category:** design - **Supports:** align (full, wide), anchor, interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Attributes:** ## Calendar @@ -172,7 +172,7 @@ Contains the block elements used to display a comment, like the title, date, aut - **Category:** design - **Parent:** core/comments - **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Comments @@ -211,7 +211,7 @@ Displays a list of page numbers for comments pagination. ([Source](https://githu - **Category:** theme - **Parent:** core/comments-pagination - **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Comments Previous Page @@ -275,7 +275,7 @@ Display footnotes added to the page. ([Source](https://github.com/WordPress/gute - **Name:** core/footnotes - **Category:** text - **Supports:** color (background, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Form @@ -304,7 +304,7 @@ Provide a notification message after the form has been submitted. ([Source](http - **Name:** core/form-submission-notification - **Experimental:** true - **Category:** common -- **Supports:** +- **Supports:** - **Attributes:** type ## Form Submit Button @@ -314,8 +314,8 @@ A submission button for forms. ([Source](https://github.com/WordPress/gutenberg/ - **Name:** core/form-submit-button - **Experimental:** true - **Category:** common -- **Supports:** -- **Attributes:** +- **Supports:** +- **Attributes:** ## Classic @@ -491,7 +491,7 @@ Separate your content into a multi-page experience. ([Source](https://github.com - **Category:** design - **Parent:** core/post-content - **Supports:** interactivity (clientNavigation), ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** +- **Attributes:** ## Page List @@ -603,7 +603,7 @@ Displays the contents of a post or page. ([Source](https://github.com/WordPress/ - **Name:** core/post-content - **Category:** theme - **Supports:** align (full, wide), color (background, gradients, link, text), dimensions (minHeight), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Attributes:** ## Date @@ -649,7 +649,7 @@ Contains the block elements used to render a post, like the title, date, feature - **Category:** theme - **Parent:** core/query - **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Post Terms @@ -714,7 +714,7 @@ Contains the block elements used to render content when no query results are fou - **Category:** theme - **Parent:** core/query - **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Pagination diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js index f3689b7b742091..42fe431a40b242 100644 --- a/packages/block-editor/src/hooks/style.js +++ b/packages/block-editor/src/hooks/style.js @@ -27,7 +27,11 @@ import { SPACING_SUPPORT_KEY, DimensionsPanel, } from './dimensions'; -import { EFFECTS_SUPPORT_KEYS, EffectsPanel } from './effects'; +import { + EFFECTS_SUPPORT_KEYS, + SHADOW_SUPPORT_KEY, + EffectsPanel, +} from './effects'; import { shouldSkipSerialization, useStyleOverride, @@ -99,10 +103,7 @@ function addAttribute( settings ) { * @type {Record} */ const skipSerializationPathsEdit = { - [ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ - 'border', - 'shadow', - ], + [ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ], [ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ COLOR_SUPPORT_KEY, ], @@ -115,6 +116,9 @@ const skipSerializationPathsEdit = { [ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ SPACING_SUPPORT_KEY, ], + [ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ + SHADOW_SUPPORT_KEY, + ], }; /** diff --git a/packages/block-library/src/button/block.json b/packages/block-library/src/button/block.json index aa5d81c65bad31..c3d51c61a0999a 100644 --- a/packages/block-library/src/button/block.json +++ b/packages/block-library/src/button/block.json @@ -98,7 +98,9 @@ } }, "reusable": false, - "shadow": true, + "shadow": { + "__experimentalSkipSerialization": true + }, "spacing": { "__experimentalSkipSerialization": true, "padding": [ "horizontal", "vertical" ], From 1009d0c9c837275814042ca318b3323100809785 Mon Sep 17 00:00:00 2001 From: madhusudhand Date: Wed, 31 Jan 2024 11:25:59 +0530 Subject: [PATCH 3/4] update block.json --- schemas/json/block.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/schemas/json/block.json b/schemas/json/block.json index 5d0c7b5281b334..9c1e89b8a601ad 100644 --- a/schemas/json/block.json +++ b/schemas/json/block.json @@ -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", From 994119abd94df3f1bb96254f46a5374dcc33faa4 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Mon, 5 Feb 2024 10:31:12 +1000 Subject: [PATCH 4/4] Update core blocks doc after rebase --- docs/reference-guides/core-blocks.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 9ec087d821cb14..380ee35909ac83 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -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 @@ -61,7 +61,7 @@ Prompt visitors to take action with a group of button-style links. ([Source](htt - **Name:** core/buttons - **Category:** design - **Supports:** align (full, wide), anchor, interactivity (clientNavigation), layout (default, ~~allowInheriting~~, ~~allowSwitching~~), spacing (blockGap, margin), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Attributes:** ## Calendar @@ -172,7 +172,7 @@ Contains the block elements used to display a comment, like the title, date, aut - **Category:** design - **Parent:** core/comments - **Supports:** align, interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Comments @@ -211,7 +211,7 @@ Displays a list of page numbers for comments pagination. ([Source](https://githu - **Category:** theme - **Parent:** core/comments-pagination - **Supports:** color (background, gradients, ~~text~~), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Comments Previous Page @@ -275,7 +275,7 @@ Display footnotes added to the page. ([Source](https://github.com/WordPress/gute - **Name:** core/footnotes - **Category:** text - **Supports:** color (background, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~, ~~inserter~~, ~~multiple~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Form @@ -304,7 +304,7 @@ Provide a notification message after the form has been submitted. ([Source](http - **Name:** core/form-submission-notification - **Experimental:** true - **Category:** common -- **Supports:** +- **Supports:** - **Attributes:** type ## Form Submit Button @@ -314,8 +314,8 @@ A submission button for forms. ([Source](https://github.com/WordPress/gutenberg/ - **Name:** core/form-submit-button - **Experimental:** true - **Category:** common -- **Supports:** -- **Attributes:** +- **Supports:** +- **Attributes:** ## Classic @@ -491,7 +491,7 @@ Separate your content into a multi-page experience. ([Source](https://github.com - **Category:** design - **Parent:** core/post-content - **Supports:** interactivity (clientNavigation), ~~className~~, ~~customClassName~~, ~~html~~ -- **Attributes:** +- **Attributes:** ## Page List @@ -603,7 +603,7 @@ Displays the contents of a post or page. ([Source](https://github.com/WordPress/ - **Name:** core/post-content - **Category:** theme - **Supports:** align (full, wide), color (background, gradients, link, text), dimensions (minHeight), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~ -- **Attributes:** +- **Attributes:** ## Date @@ -649,7 +649,7 @@ Contains the block elements used to render a post, like the title, date, feature - **Category:** theme - **Parent:** core/query - **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), layout, spacing (blockGap), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Post Terms @@ -714,7 +714,7 @@ Contains the block elements used to render content when no query results are fou - **Category:** theme - **Parent:** core/query - **Supports:** align, color (background, gradients, link, text), interactivity (clientNavigation), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ -- **Attributes:** +- **Attributes:** ## Pagination