Skip to content

Commit

Permalink
Fix getBlocks for unmodified default block
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Feb 15, 2023
1 parent 55b0c38 commit 82a5aeb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/e2e-test-utils-playwright/src/editor/get-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ export async function getBlocks( this: Editor ) {
const blocks = window.wp.data.select( 'core/block-editor' ).getBlocks();

// The editor might still contain an unmodified empty block even when it's technically "empty".
if ( blocks.length === 1 ) {
const blockName = blocks[ 0 ].name;
if (
blockName === window.wp.blocks.getDefaultBlockName() ||
blockName === window.wp.blocks.getFreeformContentHandlerName()
) {
return [];
}
if (
blocks.length === 1 &&
window.wp.blocks.isUnmodifiedDefaultBlock( blocks[ 0 ] )
) {
return [];
}

return blocks;
Expand Down

0 comments on commit 82a5aeb

Please sign in to comment.