Skip to content

Commit

Permalink
Remove pattern override experiment (#58105)
Browse files Browse the repository at this point in the history
* Completely remove the pattern overrides experiment flag

* Update test to use correct name of block bindings experiment

* Restore react native file

* Fix paths in native files

* Update pattern block test to reflect changes to inner blocks (the reusable block no longer uses controlled inner blocks)

* Fix e2e tests

---------

Co-authored-by: Kai Hao <[email protected]>
  • Loading branch information
talldan and kevin940726 authored Jan 24, 2024
1 parent 291ffb9 commit d9ed5d3
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 315 deletions.
4 changes: 1 addition & 3 deletions lib/experimental/block-bindings/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
// Register the sources.
$gutenberg_experiments = get_option( 'gutenberg-experiments' );
if ( $gutenberg_experiments ) {
if ( array_key_exists( 'gutenberg-pattern-partial-syncing', $gutenberg_experiments ) ) {
require_once __DIR__ . '/sources/pattern.php';
}
if ( array_key_exists( 'gutenberg-block-bindings', $gutenberg_experiments ) ) {
require_once __DIR__ . '/sources/pattern.php';
require_once __DIR__ . '/sources/post-meta.php';
}
}
6 changes: 1 addition & 5 deletions lib/experimental/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ function wp_enqueue_block_view_script( $block_name, $args ) {
}
}




$gutenberg_experiments = get_option( 'gutenberg-experiments' );
if ( $gutenberg_experiments && (
array_key_exists( 'gutenberg-block-bindings', $gutenberg_experiments ) ||
array_key_exists( 'gutenberg-pattern-partial-syncing', $gutenberg_experiments )
array_key_exists( 'gutenberg-block-bindings', $gutenberg_experiments )
) ) {

require_once __DIR__ . '/block-bindings/index.php';
Expand Down
4 changes: 0 additions & 4 deletions lib/experimental/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ function gutenberg_enable_experiments() {
if ( gutenberg_is_experiment_enabled( 'gutenberg-no-tinymce' ) ) {
wp_add_inline_script( 'wp-block-library', 'window.__experimentalDisableTinymce = true', 'before' );
}

if ( $gutenberg_experiments && array_key_exists( 'gutenberg-pattern-partial-syncing', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalPatternPartialSyncing = true', 'before' );
}
}

add_action( 'admin_init', 'gutenberg_enable_experiments' );
Expand Down
12 changes: 0 additions & 12 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,6 @@ function gutenberg_initialize_experiments_settings() {
)
);

add_settings_field(
'gutenberg-pattern-partial-syncing',
__( 'Pattern overrides', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Test overrides in synced patterns', 'gutenberg' ),
'id' => 'gutenberg-pattern-partial-syncing',
)
);

register_setting(
'gutenberg-experiments',
'gutenberg-experiments'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
topLevelLockedBlock:
__unstableGetContentLockingParent( _selectedBlockClientId ) ||
( getTemplateLock( _selectedBlockClientId ) === 'contentOnly' ||
( _selectedBlockName === 'core/block' &&
window.__experimentalPatternPartialSyncing )
_selectedBlockName === 'core/block'
? _selectedBlockClientId
: undefined ),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ export function useInBetweenInserter() {
if (
getTemplateLock( rootClientId ) ||
getBlockEditingMode( rootClientId ) === 'disabled' ||
( getBlockName( rootClientId ) === 'core/block' &&
window.__experimentalPatternPartialSyncing )
getBlockName( rootClientId ) === 'core/block'
) {
return;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2721,8 +2721,7 @@ export const __unstableGetContentLockingParent = createSelector(
current = state.blocks.parents.get( current );
if (
( current &&
getBlockName( state, current ) === 'core/block' &&
window.__experimentalPatternPartialSyncing ) ||
getBlockName( state, current ) === 'core/block' ) ||
( current &&
getTemplateLock( state, current ) === 'contentOnly' )
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import { store as noticesStore } from '@wordpress/notices';
/**
* Internal dependencies
*/
import styles from '../editor.scss';
import EditTitle from '../edit-title';
import styles from './editor.scss';
import EditTitle from './edit-title';

export default function ReusableBlockEdit( {
attributes: { ref },
Expand Down
5 changes: 2 additions & 3 deletions packages/block-library/src/block/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ import { symbol as icon } from '@wordpress/icons';
*/
import initBlock from '../utils/init-block';
import metadata from './block.json';
import editV1 from './v1/edit';
import editV2 from './edit';
import edit from './edit';

const { name } = metadata;

export { metadata, name };

export const settings = {
edit: window.__experimentalPatternPartialSyncing ? editV2 : editV1,
edit,
icon,
};

Expand Down
163 changes: 0 additions & 163 deletions packages/block-library/src/block/v1/edit.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Pattern blocks allows conversion back to blocks when the reusable block has unsaved edits 1`] = `
"<!-- wp:paragraph -->
<p>12</p>
<p>1</p>
<!-- /wp:paragraph -->"
`;

Expand Down
Loading

0 comments on commit d9ed5d3

Please sign in to comment.