diff --git a/lib/compat/experimental/blocks.php b/lib/compat/experimental/blocks.php index fbd109ec181038..030963305cb2e2 100644 --- a/lib/compat/experimental/blocks.php +++ b/lib/compat/experimental/blocks.php @@ -166,12 +166,16 @@ function ( $response ) { add_action( 'rest_api_init', 'gutenberg_rest_comment_set_children_as_embeddable' ); /** - * Sets a global JS variable used to trigger the availability of the experimental list block. + * Sets a global JS variable used to trigger the availability of the experimental blocks. */ -function gutenberg_enable_experimental_list_block() { +function gutenberg_enable_experimental_blocks() { if ( get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-list-v2', get_option( 'gutenberg-experiments' ) ) ) { wp_add_inline_script( 'wp-block-library', 'window.__experimentalEnableListBlockV2 = true', 'before' ); } + + if ( get_option( 'gutenberg-experiments' ) && array_key_exists( 'gutenberg-quote-v2', get_option( 'gutenberg-experiments' ) ) ) { + wp_add_inline_script( 'wp-block-library', 'window.__experimentalEnableQuoteBlockV2 = true', 'before' ); + } } -add_action( 'admin_init', 'gutenberg_enable_experimental_list_block' ); +add_action( 'admin_init', 'gutenberg_enable_experimental_blocks' ); diff --git a/lib/experiments-page.php b/lib/experiments-page.php index a0aabb3f3ec6ba..23a6af6207941d 100644 --- a/lib/experiments-page.php +++ b/lib/experiments-page.php @@ -62,6 +62,17 @@ function gutenberg_initialize_experiments_settings() { 'id' => 'gutenberg-list-v2', ) ); + add_settings_field( + 'gutenberg-quote-v2', + __( 'Quote block v2', 'gutenberg' ), + 'gutenberg_display_experiment_field', + 'gutenberg-experiments', + 'gutenberg_experiments_section', + array( + 'label' => __( 'Test a new quote block that allows nested blocks (Warning: The new block is not ready. You may experience content loss, avoid using it on production sites)', 'gutenberg' ), + 'id' => 'gutenberg-quote-v2', + ) + ); register_setting( 'gutenberg-experiments', 'gutenberg-experiments' diff --git a/packages/block-library/src/quote/index.js b/packages/block-library/src/quote/index.js index 621365a46abbe1..13876d46974b99 100644 --- a/packages/block-library/src/quote/index.js +++ b/packages/block-library/src/quote/index.js @@ -12,12 +12,13 @@ import edit from './edit'; import metadata from './block.json'; import save from './save'; import transforms from './transforms'; +import settingsV2 from './v2'; const { name } = metadata; export { metadata, name }; -export const settings = { +export const settingsV1 = { icon, example: { attributes: { @@ -51,3 +52,7 @@ export const settings = { }, deprecated, }; + +export const settings = window?.__experimentalEnableQuoteBlockV2 + ? settingsV2 + : settingsV1; diff --git a/packages/block-library/src/quote/v2/edit.js b/packages/block-library/src/quote/v2/edit.js new file mode 100644 index 00000000000000..d64d4b36538ef2 --- /dev/null +++ b/packages/block-library/src/quote/v2/edit.js @@ -0,0 +1,5 @@ +function Edit() { + return