Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
david-szabo97 committed Mar 2, 2021
1 parent 34e4aad commit ac25ca5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/block-editor/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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,
[]
);

Expand Down
3 changes: 3 additions & 0 deletions packages/edit-post/src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
SlotFillProvider,
__unstableDropZoneContextProvider as DropZoneContextProvider,
} from '@wordpress/components';
import { __experimentalPreParsePatterns as usePreParsePatterns } from '@wordpress/block-editor';

/**
* Internal dependencies
Expand Down Expand Up @@ -166,6 +167,8 @@ function Editor( {
return hasThemeStyles ? settings.styles : settings.defaultEditorStyles;
}, [ settings, hasThemeStyles ] );

usePreParsePatterns();

if ( ! post ) {
return null;
}
Expand Down
7 changes: 5 additions & 2 deletions packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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' ),
Expand Down

0 comments on commit ac25ca5

Please sign in to comment.