Skip to content

Commit

Permalink
Revert "enable FloatingToolbar for all blocks" (#20527)
Browse files Browse the repository at this point in the history
This reverts commit bc89a81.
  • Loading branch information
jbinda authored Mar 4, 2020
1 parent 34493ca commit a437dbd
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class BlockListBlock extends Component {
title,
parentId,
isTouchable,
showFloatingToolbar,
} = this.props;

const accessibilityLabel = getAccessibleBlockLabel(
Expand All @@ -204,7 +205,7 @@ class BlockListBlock extends Component {
accessibilityRole={ 'button' }
>
<View accessibilityLabel={ accessibilityLabel }>
{ isSelected && (
{ showFloatingToolbar && (
<FloatingToolbar>
<Toolbar passedStyle={ styles.toolbar }>
<ToolbarButton
Expand Down Expand Up @@ -252,6 +253,7 @@ export default compose( [
__unstableGetBlockWithoutInnerBlocks,
getBlockHierarchyRootClientId,
getSelectedBlockClientId,
getBlock,
getBlockRootClientId,
getLowestCommonAncestorWithSelectedBlock,
getBlockParents,
Expand All @@ -273,6 +275,10 @@ export default compose( [
const parentId = parents[ 0 ] || '';

const rootBlockId = getBlockHierarchyRootClientId( clientId );
const rootBlock = getBlock( rootBlockId );
const hasRootInnerBlocks = rootBlock.innerBlocks.length !== 0;

const showFloatingToolbar = isSelected && hasRootInnerBlocks;

const selectedBlockClientId = getSelectedBlockClientId();

Expand Down Expand Up @@ -333,6 +339,7 @@ export default compose( [
isTouchable,
isDimmed,
isUnregisteredBlock,
showFloatingToolbar,
};
} ),
withDispatch( ( dispatch, ownProps, { select } ) => {
Expand Down

0 comments on commit a437dbd

Please sign in to comment.