Skip to content

Commit 0488e29

Browse files
authored
Details Block: Remove experimental flag and stabilize (#50997)
* Details Block: Enable by default on Gutenberg plugin without opt-in * Add fixture * Stabilize the block
1 parent da158af commit 0488e29

File tree

9 files changed

+60
-20
lines changed

9 files changed

+60
-20
lines changed

docs/reference-guides/core-blocks.md

-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ Add an image or video with a text overlay. ([Source](https://github.com/WordPres
247247
Hide and show additional content. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/details))
248248

249249
- **Name:** core/details
250-
- **Experimental:** true
251250
- **Category:** text
252251
- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
253252
- **Attributes:** showContent, summary

lib/experimental/editor-settings.php

-3
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ function gutenberg_enable_experiments() {
8686
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-group-grid-variation', $gutenberg_experiments ) ) {
8787
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGroupGridVariation = true', 'before' );
8888
}
89-
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-details-blocks', $gutenberg_experiments ) ) {
90-
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableDetailsBlocks = true', 'before' );
91-
}
9289
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-pattern-enhancements', $gutenberg_experiments ) ) {
9390
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnablePatternEnhancements = true', 'before' );
9491
}

lib/experiments-page.php

-12
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,6 @@ function gutenberg_initialize_experiments_settings() {
7777
)
7878
);
7979

80-
add_settings_field(
81-
'gutenberg-details-blocks',
82-
__( 'Details block', 'gutenberg' ),
83-
'gutenberg_display_experiment_field',
84-
'gutenberg-experiments',
85-
'gutenberg_experiments_section',
86-
array(
87-
'label' => __( 'Test the Details block', 'gutenberg' ),
88-
'id' => 'gutenberg-details-blocks',
89-
)
90-
);
91-
9280
add_settings_field(
9381
'gutenberg-theme-previews',
9482
__( 'Block Theme Previews', 'gutenberg' ),

packages/block-library/src/details/block.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "https://schemas.wp.org/trunk/block.json",
33
"apiVersion": 2,
4-
"__experimental": true,
54
"name": "core/details",
65
"title": "Details",
76
"category": "text",

packages/block-library/src/index.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const getAllBlocks = () => {
147147
columns,
148148
commentAuthorAvatar,
149149
cover,
150+
details,
150151
embed,
151152
file,
152153
group,
@@ -226,9 +227,6 @@ const getAllBlocks = () => {
226227
queryTitle,
227228
postAuthorBiography,
228229
];
229-
if ( window?.__experimentalEnableDetailsBlocks ) {
230-
blocks.push( details );
231-
}
232230
return blocks.filter( Boolean );
233231
};
234232

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!-- wp:details {"summary":"Details Summary"} -->
2+
<details class="wp-block-details"><summary>Details Summary</summary>
3+
<!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
4+
<p>Details Content</p>
5+
<!-- /wp:paragraph -->
6+
</details>
7+
<!-- /wp:details -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[
2+
{
3+
"name": "core/details",
4+
"isValid": true,
5+
"attributes": {
6+
"showContent": false,
7+
"summary": "Details Summary"
8+
},
9+
"innerBlocks": [
10+
{
11+
"name": "core/paragraph",
12+
"isValid": true,
13+
"attributes": {
14+
"content": "Details Content",
15+
"dropCap": false,
16+
"placeholder": "Type / to add a hidden block"
17+
},
18+
"innerBlocks": []
19+
}
20+
]
21+
}
22+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[
2+
{
3+
"blockName": "core/details",
4+
"attrs": {
5+
"summary": "Details Summary"
6+
},
7+
"innerBlocks": [
8+
{
9+
"blockName": "core/paragraph",
10+
"attrs": {
11+
"placeholder": "Type / to add a hidden block"
12+
},
13+
"innerBlocks": [],
14+
"innerHTML": "\n\t<p>Details Content</p>\n\t",
15+
"innerContent": [ "\n\t<p>Details Content</p>\n\t" ]
16+
}
17+
],
18+
"innerHTML": "\n<details class=\"wp-block-details\"><summary>Details Summary</summary>\n\t\n</details>\n",
19+
"innerContent": [
20+
"\n<details class=\"wp-block-details\"><summary>Details Summary</summary>\n\t",
21+
null,
22+
"\n</details>\n"
23+
]
24+
}
25+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!-- wp:details {"summary":"Details Summary"} -->
2+
<details class="wp-block-details"><summary>Details Summary</summary><!-- wp:paragraph {"placeholder":"Type / to add a hidden block"} -->
3+
<p>Details Content</p>
4+
<!-- /wp:paragraph --></details>
5+
<!-- /wp:details -->

0 commit comments

Comments
 (0)