diff --git a/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js b/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js index 3e772190ebcba7..b9aeef8db19535 100644 --- a/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js +++ b/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js @@ -24,6 +24,7 @@ import { useEntityBlockEditor, store as coreStore } from '@wordpress/core-data'; import { buildWidgetAreasPostId, KIND, POST_TYPE } from '../../store/utils'; import useLastSelectedWidgetArea from '../../hooks/use-last-selected-widget-area'; import { store as editWidgetsStore } from '../../store'; +import { ALLOW_REUSABLE_BLOCKS } from '../../constants'; export default function WidgetAreasBlockEditorProvider( { blockEditorSettings, @@ -43,10 +44,9 @@ export default function WidgetAreasBlockEditorProvider( { ), widgetAreas: select( editWidgetsStore ).getWidgetAreas(), widgets: select( editWidgetsStore ).getWidgets(), - reusableBlocks: select( coreStore ).getEntityRecords( - 'postType', - 'wp_block' - ), + reusableBlocks: ALLOW_REUSABLE_BLOCKS + ? select( coreStore ).getEntityRecords( 'postType', 'wp_block' ) + : [], isFixedToolbarActive: select( editWidgetsStore ).__unstableIsFeatureActive( 'fixedToolbar' ), diff --git a/packages/edit-widgets/src/constants.js b/packages/edit-widgets/src/constants.js new file mode 100644 index 00000000000000..22c010b2fc11ad --- /dev/null +++ b/packages/edit-widgets/src/constants.js @@ -0,0 +1 @@ +export const ALLOW_REUSABLE_BLOCKS = false; diff --git a/packages/edit-widgets/src/index.js b/packages/edit-widgets/src/index.js index 85355cea7d84dd..1c621c7a7cae97 100644 --- a/packages/edit-widgets/src/index.js +++ b/packages/edit-widgets/src/index.js @@ -24,8 +24,12 @@ import './store'; import './filters'; import * as widgetArea from './blocks/widget-area'; import Layout from './components/layout'; +import { ALLOW_REUSABLE_BLOCKS } from './constants'; -const DISABLED_BLOCKS = [ 'core/more', 'core/block' ]; +const DISABLED_BLOCKS = [ + 'core/more', + ...( ! ALLOW_REUSABLE_BLOCKS && [ 'core/block' ] ), +]; const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; /** @@ -55,6 +59,7 @@ export function initialize( id, settings ) { registerBlock( widgetArea ); settings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) => fetchLinkSuggestions( search, searchOptions, settings ); + render( , document.getElementById( id )