Skip to content
Prev Previous commit
Next Next commit
Reverting hasInnerBlocks change to punt to another PR. It will requir…
…ed E2E test changes and more manual testing in post and site editors.
  • Loading branch information
ramonjd committed Jan 12, 2024
commit f995eb3d662a446f1f860ab09f6c52e6282e2db5
27 changes: 20 additions & 7 deletions packages/block-library/src/post-content/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ import {
Warning,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { useEntityProp, useEntityBlockEditor } from '@wordpress/core-data';
import {
useEntityProp,
useEntityBlockEditor,
store as coreStore,
} from '@wordpress/core-data';
import { useSelect, useDispatch } from '@wordpress/data';
import { Placeholder, Button } from '@wordpress/components';
import { postContent as icon } from '@wordpress/icons';
Expand Down Expand Up @@ -101,14 +105,23 @@ function EditableContent( { context = {}, clientId } ) {
{ id: postId }
);

const setInserterIsOpened = useSelect(
( select ) =>
select( blockEditorStore ).getSettings()
.__experimentalSetIsInserterOpened,
[]
const { entityRecord, setInserterIsOpened } = useSelect(
( select ) => {
return {
entityRecord: select( coreStore ).getEntityRecord(
'postType',
postType,
postId
),
setInserterIsOpened:
select( blockEditorStore ).getSettings()
.__experimentalSetIsInserterOpened,
};
},
[ postType, postId ]
);

const hasInnerBlocks = !! blocks?.length;
const hasInnerBlocks = !! entityRecord?.content?.raw || blocks?.length;

const { children, ...props } = useInnerBlocksProps(
useBlockProps( {
Expand Down