Skip to content

Commit

Permalink
Display trailing appender when the page is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jeyip committed Aug 28, 2020
1 parent b670f4b commit 97d9cea
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ function BlockListAppender( {
selectedBlockClientId,
tagName: TagName = 'div',
} ) {
const hasSiblingsSelected =
selectedBlockClientId &&
blockClientIds.includes( selectedBlockClientId );

if ( isLocked || CustomAppender === false || ! hasSiblingsSelected ) {
if ( isLocked || CustomAppender === false ) {
return null;
}

Expand All @@ -45,6 +41,14 @@ function BlockListAppender( {
} else if ( canInsertDefaultBlock ) {
// Render the default block appender when renderAppender has not been
// provided and the context supports use of the default appender.
const isDocumentAppender = ! rootClientId;
const isAnotherDefaultAppenderAlreadyDisplayed =
selectedBlockClientId &&
! blockClientIds.includes( selectedBlockClientId );

if ( ! isDocumentAppender && isAnotherDefaultAppenderAlreadyDisplayed )
return null;

appender = (
<DefaultBlockAppender
rootClientId={ rootClientId }
Expand Down

0 comments on commit 97d9cea

Please sign in to comment.