From 7bc8e5c6a143cdacd1e1f4bf070f98c666a5c658 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 26 May 2023 18:00:39 +0900 Subject: [PATCH 1/3] Details Block: Enable by default on Gutenberg plugin without opt-in --- lib/experimental/editor-settings.php | 3 --- lib/experiments-page.php | 12 ------------ packages/block-library/src/index.js | 4 +--- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/experimental/editor-settings.php b/lib/experimental/editor-settings.php index 9571d50fdf3f27..67e08265558e1f 100644 --- a/lib/experimental/editor-settings.php +++ b/lib/experimental/editor-settings.php @@ -86,9 +86,6 @@ function gutenberg_enable_experiments() { if ( $gutenberg_experiments && array_key_exists( 'gutenberg-group-grid-variation', $gutenberg_experiments ) ) { wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGroupGridVariation = true', 'before' ); } - if ( $gutenberg_experiments && array_key_exists( 'gutenberg-details-blocks', $gutenberg_experiments ) ) { - wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableDetailsBlocks = true', 'before' ); - } if ( $gutenberg_experiments && array_key_exists( 'gutenberg-pattern-enhancements', $gutenberg_experiments ) ) { wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnablePatternEnhancements = true', 'before' ); } diff --git a/lib/experiments-page.php b/lib/experiments-page.php index 9e31815f3f50ff..eb6a1ea8a7336c 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -77,18 +77,6 @@ function gutenberg_initialize_experiments_settings() { ) ); - add_settings_field( - 'gutenberg-details-blocks', - __( 'Details block', 'gutenberg' ), - 'gutenberg_display_experiment_field', - 'gutenberg-experiments', - 'gutenberg_experiments_section', - array( - 'label' => __( 'Test the Details block', 'gutenberg' ), - 'id' => 'gutenberg-details-blocks', - ) - ); - add_settings_field( 'gutenberg-theme-previews', __( 'Block Theme Previews', 'gutenberg' ), diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index a0c7b75eac19b8..73c2f1eb1140a2 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -147,6 +147,7 @@ const getAllBlocks = () => { columns, commentAuthorAvatar, cover, + details, embed, file, group, @@ -226,9 +227,6 @@ const getAllBlocks = () => { queryTitle, postAuthorBiography, ]; - if ( window?.__experimentalEnableDetailsBlocks ) { - blocks.push( details ); - } return blocks.filter( Boolean ); }; From 43c2e2deb7e285c6e0ebb9616950210c77e71ca7 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 26 May 2023 18:57:02 +0900 Subject: [PATCH 2/3] Add fixture --- .../fixtures/blocks/core__details.html | 7 ++++++ .../fixtures/blocks/core__details.json | 22 ++++++++++++++++ .../fixtures/blocks/core__details.parsed.json | 25 +++++++++++++++++++ .../blocks/core__details.serialized.html | 5 ++++ 4 files changed, 59 insertions(+) create mode 100644 test/integration/fixtures/blocks/core__details.html create mode 100644 test/integration/fixtures/blocks/core__details.json create mode 100644 test/integration/fixtures/blocks/core__details.parsed.json create mode 100644 test/integration/fixtures/blocks/core__details.serialized.html diff --git a/test/integration/fixtures/blocks/core__details.html b/test/integration/fixtures/blocks/core__details.html new file mode 100644 index 00000000000000..855ea3f0a4f556 --- /dev/null +++ b/test/integration/fixtures/blocks/core__details.html @@ -0,0 +1,7 @@ + +
Details Summary + +

Details Content

+ +
+ diff --git a/test/integration/fixtures/blocks/core__details.json b/test/integration/fixtures/blocks/core__details.json new file mode 100644 index 00000000000000..e3873e4702db3f --- /dev/null +++ b/test/integration/fixtures/blocks/core__details.json @@ -0,0 +1,22 @@ +[ + { + "name": "core/details", + "isValid": true, + "attributes": { + "showContent": false, + "summary": "Details Summary" + }, + "innerBlocks": [ + { + "name": "core/paragraph", + "isValid": true, + "attributes": { + "content": "Details Content", + "dropCap": false, + "placeholder": "Type / to add a hidden block" + }, + "innerBlocks": [] + } + ] + } +] diff --git a/test/integration/fixtures/blocks/core__details.parsed.json b/test/integration/fixtures/blocks/core__details.parsed.json new file mode 100644 index 00000000000000..3240c013e8e866 --- /dev/null +++ b/test/integration/fixtures/blocks/core__details.parsed.json @@ -0,0 +1,25 @@ +[ + { + "blockName": "core/details", + "attrs": { + "summary": "Details Summary" + }, + "innerBlocks": [ + { + "blockName": "core/paragraph", + "attrs": { + "placeholder": "Type / to add a hidden block" + }, + "innerBlocks": [], + "innerHTML": "\n\t

Details Content

\n\t", + "innerContent": [ "\n\t

Details Content

\n\t" ] + } + ], + "innerHTML": "\n
Details Summary\n\t\n
\n", + "innerContent": [ + "\n
Details Summary\n\t", + null, + "\n
\n" + ] + } +] diff --git a/test/integration/fixtures/blocks/core__details.serialized.html b/test/integration/fixtures/blocks/core__details.serialized.html new file mode 100644 index 00000000000000..d5d169983bbf38 --- /dev/null +++ b/test/integration/fixtures/blocks/core__details.serialized.html @@ -0,0 +1,5 @@ + +
Details Summary +

Details Content

+
+ From f0a57e3ea0a60f0394e62794e7fc5d8b1e10ee62 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 26 May 2023 19:00:38 +0900 Subject: [PATCH 3/3] Stabilize the block --- docs/reference-guides/core-blocks.md | 1 - packages/block-library/src/details/block.json | 1 - 2 files changed, 2 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index b84d8edb8e9d98..559417fa5dff76 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -247,7 +247,6 @@ Add an image or video with a text overlay. ([Source](https://github.com/WordPres Hide and show additional content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/details)) - **Name:** core/details -- **Experimental:** true - **Category:** text - **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** showContent, summary diff --git a/packages/block-library/src/details/block.json b/packages/block-library/src/details/block.json index 40321ee6b0c9c1..4eb7af8d5ce623 100644 --- a/packages/block-library/src/details/block.json +++ b/packages/block-library/src/details/block.json @@ -1,7 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2, - "__experimental": true, "name": "core/details", "title": "Details", "category": "text",