Skip to content

Commit

Permalink
Comment Template: Move inner blocks container to separate components (#…
Browse files Browse the repository at this point in the history
…36174)

Inspired by #35945 from @andrewserong.
  • Loading branch information
gziolo authored Nov 3, 2021
1 parent f871c50 commit 44533df
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/block-library/src/comment-template/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ const TEMPLATE = [
[ 'core/post-comment-content' ],
];

function CommentTemplateInnerBlocks() {
const innerBlocksProps = useInnerBlocksProps( {}, { template: TEMPLATE } );
return <li { ...innerBlocksProps } />;
}

export default function CommentTemplateEdit( {
clientId,
context: { postId, queryPerPage },
} ) {
const innerBlocksProps = useInnerBlocksProps( {}, { template: TEMPLATE } );
const blockProps = useBlockProps();

const [ activeBlockContext, setActiveBlockContext ] = useState();
Expand Down Expand Up @@ -74,7 +78,7 @@ export default function CommentTemplateEdit( {
>
{ blockContext ===
( activeBlockContext || blockContexts[ 0 ] ) ? (
<li { ...innerBlocksProps } />
<CommentTemplateInnerBlocks />
) : (
<li>
<BlockPreview
Expand Down

0 comments on commit 44533df

Please sign in to comment.