diff --git a/packages/block-library/src/post-template/edit.js b/packages/block-library/src/post-template/edit.js index 3db9bf465fa05d..c4424ebf2e05c6 100644 --- a/packages/block-library/src/post-template/edit.js +++ b/packages/block-library/src/post-template/edit.js @@ -6,16 +6,14 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { memo, useMemo, useState } from '@wordpress/element'; +import { useMemo } from '@wordpress/element'; import { useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { BlockControls, BlockContextProvider, - __experimentalUseBlockPreview as useBlockPreview, useBlockProps, useInnerBlocksProps, - store as blockEditorStore, } from '@wordpress/block-editor'; import { Spinner, ToolbarGroup } from '@wordpress/components'; import { store as coreStore } from '@wordpress/core-data'; @@ -35,42 +33,6 @@ function PostTemplateInnerBlocks() { return
  • ; } -function PostTemplateBlockPreview( { - blocks, - blockContextId, - isHidden, - setActiveBlockContextId, -} ) { - const blockPreviewProps = useBlockPreview( { - blocks, - props: { - className: 'wp-block-post', - }, - } ); - - const handleOnClick = () => { - setActiveBlockContextId( blockContextId ); - }; - - const style = { - display: isHidden ? 'none' : undefined, - }; - - return ( -
  • - ); -} - -const MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview ); - export default function PostTemplateEdit( { setAttributes, clientId, @@ -103,11 +65,9 @@ export default function PostTemplateEdit( { __unstableLayoutClassNames, } ) { const { type: layoutType, columnCount = 3 } = layout || {}; - const [ activeBlockContextId, setActiveBlockContextId ] = useState(); - const { posts, blocks } = useSelect( + const { posts } = useSelect( ( select ) => { const { getEntityRecords, getTaxonomies } = select( coreStore ); - const { getBlocks } = select( blockEditorStore ); const templateCategory = inherit && templateSlug?.startsWith( 'category-' ) && @@ -186,7 +146,6 @@ export default function PostTemplateEdit( { ...query, ...restQueryArgs, } ), - blocks: getBlocks( clientId ), }; }, [ @@ -277,23 +236,7 @@ export default function PostTemplateEdit( { key={ blockContext.postId } value={ blockContext } > - { blockContext.postId === - ( activeBlockContextId || - blockContexts[ 0 ]?.postId ) ? ( - - ) : null } - + ) ) }