diff --git a/packages/block-editor/src/utils/index.js b/packages/block-editor/src/utils/index.js index f498a6bf4740b..509fa610d9652 100644 --- a/packages/block-editor/src/utils/index.js +++ b/packages/block-editor/src/utils/index.js @@ -1,3 +1,4 @@ export { default as transformStyles } from './transform-styles'; export * from './theme'; export * from './block-variation-transforms'; +export { usePreParsePatterns as __experimentalPreParsePatterns } from './pre-parse-patterns'; diff --git a/packages/edit-site/src/components/editor/pre-parse-patterns.js b/packages/block-editor/src/utils/pre-parse-patterns.js similarity index 84% rename from packages/edit-site/src/components/editor/pre-parse-patterns.js rename to packages/block-editor/src/utils/pre-parse-patterns.js index 4eda56c3e583f..06ba3ce2120a1 100644 --- a/packages/edit-site/src/components/editor/pre-parse-patterns.js +++ b/packages/block-editor/src/utils/pre-parse-patterns.js @@ -3,17 +3,17 @@ */ import { useSelect, select } from '@wordpress/data'; import { useEffect } from '@wordpress/element'; -import { store as blockEditorStore } from '@wordpress/block-editor'; /** * Internal dependencies */ -import { store as editSiteStore } from '../../store'; +import { store as blockEditorStore } from '../store'; export function usePreParsePatterns() { const patterns = useSelect( ( _select ) => - _select( editSiteStore ).getSettings().__experimentalBlockPatterns, + _select( blockEditorStore ).getSettings() + .__experimentalBlockPatterns, [] ); diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index 89c0e8efae5c6..f7d5cc69a5da5 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -19,6 +19,7 @@ import { SlotFillProvider, __unstableDropZoneContextProvider as DropZoneContextProvider, } from '@wordpress/components'; +import { __experimentalPreParsePatterns as usePreParsePatterns } from '@wordpress/block-editor'; /** * Internal dependencies @@ -166,6 +167,8 @@ function Editor( { return hasThemeStyles ? settings.styles : settings.defaultEditorStyles; }, [ settings, hasThemeStyles ] ); + usePreParsePatterns(); + if ( ! post ) { return null; } diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index 8ab8103d4c94e..030a2f338973d 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -10,7 +10,11 @@ import { Button, } from '@wordpress/components'; import { EntityProvider } from '@wordpress/core-data'; -import { BlockContextProvider, BlockBreadcrumb } from '@wordpress/block-editor'; +import { + BlockContextProvider, + BlockBreadcrumb, + __experimentalPreParsePatterns as usePreParsePatterns, +} from '@wordpress/block-editor'; import { FullscreenMode, InterfaceSkeleton, @@ -35,7 +39,6 @@ import URLQueryController from '../url-query-controller'; import InserterSidebar from '../secondary-sidebar/inserter-sidebar'; import ListViewSidebar from '../secondary-sidebar/list-view-sidebar'; import { store as editSiteStore } from '../../store'; -import { usePreParsePatterns } from './pre-parse-patterns'; const interfaceLabels = { secondarySidebar: __( 'Block Library' ),