Skip to content

Commit

Permalink
More changes per review
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 16, 2023
1 parent e1c1cb0 commit ea30164
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@ export default function EditTemplate() {
select( blockEditorStore );
const _context = getEditedPostContext();
const _postType = getEditedPostType();
const queryArgs = [
'postType',
getEditedPostType(),
getEditedPostId(),
];
const queryArgs = [ 'postType', _postType, getEditedPostId() ];
return {
hasPostContentBlocks: !! __experimentalGetGlobalBlocksByName(
Object.keys( PAGE_CONTENT_BLOCK_TYPES )
Expand Down
10 changes: 5 additions & 5 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ function useForceFocusModeForNavigation( navigationBlockClientId ) {
*
* @return {Array} Flattened object.
*/
function extractedPageContentBlockTypesFromTemplateBlocks( blocks ) {
function extractPageContentBlockTypesFromTemplateBlocks( blocks ) {
const result = [];
for ( let i = 0; i < blocks.length; i++ ) {
// Since the Query Block could contain PAGE_CONTENT_BLOCK_TYPES block types,
// we skip it because we only want to render stand-alone page content blocks in the block list.
if ( [ 'core/query' ].includes( blocks[ i ].name ) ) {
if ( blocks[ i ].name === 'core/query' ) {
continue;
}
if ( PAGE_CONTENT_BLOCK_TYPES.includes( blocks[ i ].name ) ) {
result.push( createBlock( blocks[ i ].name ) );
}
if ( blocks[ i ].innerBlocks.length ) {
result.push(
...extractedPageContentBlockTypesFromTemplateBlocks(
...extractPageContentBlockTypesFromTemplateBlocks(
blocks[ i ].innerBlocks
)
);
Expand All @@ -99,7 +99,7 @@ function extractedPageContentBlockTypesFromTemplateBlocks( blocks ) {
*
* @param {Array} post Block list.
* @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.
* @param {boolean} mode Rendering mode.
* @param {string} mode Rendering mode.
* @return {Array} Block editor props.
*/
function useBlockEditorProps( post, template, mode ) {
Expand Down Expand Up @@ -141,7 +141,7 @@ function useBlockEditorProps( post, template, mode ) {
},
},
},
extractedPageContentBlockTypesFromTemplateBlocks(
extractPageContentBlockTypesFromTemplateBlocks(
templateBlocks
)
),
Expand Down

0 comments on commit ea30164

Please sign in to comment.