Skip to content

Commit

Permalink
pass parent layout to block preview
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Oct 10, 2024
1 parent 84ffeeb commit 0a7e557
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/src/post-content/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { useMemo } from '@wordpress/element';
import { useCanEditEntity } from '../utils/hooks';

function ReadOnlyContent( {
parentLayout,
layoutClassNames,
userCanEdit,
postType,
Expand All @@ -43,6 +44,7 @@ function ReadOnlyContent( {
const blockPreviewProps = useBlockPreview( {
blocks,
props: blockProps,
layout: parentLayout,
} );

if ( userCanEdit ) {
Expand Down Expand Up @@ -120,6 +122,7 @@ function Content( props ) {
<EditableContent { ...props } />
) : (
<ReadOnlyContent
parentLayout={ props.parentLayout }
layoutClassNames={ layoutClassNames }
userCanEdit={ userCanEdit }
postType={ postType }
Expand Down Expand Up @@ -165,6 +168,7 @@ function RecursionError() {
export default function PostContentEdit( {
context,
__unstableLayoutClassNames: layoutClassNames,
__unstableParentLayout: parentLayout,
} ) {
const { postId: contextPostId, postType: contextPostType } = context;
const hasAlreadyRendered = useHasRecursion( contextPostId );
Expand All @@ -178,6 +182,7 @@ export default function PostContentEdit( {
{ contextPostId && contextPostType ? (
<Content
context={ context }
parentLayout={ parentLayout }
layoutClassNames={ layoutClassNames }
/>
) : (
Expand Down

0 comments on commit 0a7e557

Please sign in to comment.