Skip to content

Commit

Permalink
Edit Post: Fix the 'usePaddingAppender' error
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed May 8, 2024
1 parent 14ecb1d commit 612d6c5
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function usePaddingAppender() {
return;
}

// only handle clicks under the last child
// Only handle clicks under the last child.
const lastChild = node.lastElementChild;
if ( ! lastChild ) {
return;
Expand All @@ -44,6 +44,12 @@ export function usePaddingAppender() {
.select( blockEditorStore )
.getBlockOrder( '' );
const lastBlockClientId = blockOrder[ blockOrder.length - 1 ];

// Do nothing when only default block appender is present.
if ( ! lastBlockClientId ) {
return;
}

const lastBlock = registry
.select( blockEditorStore )
.getBlock( lastBlockClientId );
Expand Down

0 comments on commit 612d6c5

Please sign in to comment.