From 1a2961a5d839873cf71e2956ace258e8784928a5 Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Tue, 22 Sep 2020 04:27:36 -0500 Subject: [PATCH] Remove appender from unselected Buttons and Social Icons blocks. (#25518) --- .../components/block-list-appender/index.js | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/block-editor/src/components/block-list-appender/index.js b/packages/block-editor/src/components/block-list-appender/index.js index dda72ea6b22d1..e2a4dbb0ebd6b 100644 --- a/packages/block-editor/src/components/block-list-appender/index.js +++ b/packages/block-editor/src/components/block-list-appender/index.js @@ -38,9 +38,7 @@ function BlockListAppender( { if ( CustomAppender ) { // Prefer custom render prop if provided. appender = ; - } else if ( canInsertDefaultBlock ) { - // Render the default block appender when renderAppender has not been - // provided and the context supports use of the default appender. + } else { const isDocumentAppender = ! rootClientId; const isParentSelected = selectedBlockClientId === rootClientId; const isAnotherDefaultAppenderAlreadyDisplayed = @@ -50,26 +48,31 @@ function BlockListAppender( { if ( ! isDocumentAppender && ! isParentSelected && - isAnotherDefaultAppenderAlreadyDisplayed + ( ! selectedBlockClientId || + isAnotherDefaultAppenderAlreadyDisplayed ) ) { return null; } - appender = ( - - ); - } else { - // Fallback in the case no renderAppender has been provided and the - // default block can't be inserted. - appender = ( - - ); + if ( canInsertDefaultBlock ) { + // Render the default block appender when renderAppender has not been + // provided and the context supports use of the default appender. + appender = ( + + ); + } else { + // Fallback in the case no renderAppender has been provided and the + // default block can't be inserted. + appender = ( + + ); + } } return (