From 998456fa95457870be68670707adb056e17cefc9 Mon Sep 17 00:00:00 2001 From: Zebulan Stanphill Date: Mon, 21 Sep 2020 15:24:03 -0500 Subject: [PATCH] Remove appender from unselected Buttons block. --- .../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 dda72ea6b22d19..e2a4dbb0ebd6bc 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 (