Skip to content

Commit

Permalink
Inserter: fix line to show again
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Mar 25, 2020
1 parent 3d676ed commit 9beb5c9
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/block-editor/src/components/block-list/insertion-point.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function Indicator( { clientId } ) {
return (
isBlockInsertionPointVisible() &&
insertionPoint.index === blockIndex &&
insertionPoint.rootClientId === rootClientId
( insertionPoint.rootClientId || '' ) === rootClientId
);
},
[ clientId ]
Expand Down Expand Up @@ -61,15 +61,19 @@ export default function InsertionPoint( {
const [ inserterElement, setInserterElement ] = useState( null );
const [ inserterClientId, setInserterClientId ] = useState( null );
const ref = useRef();
const { multiSelectedBlockClientIds } = useSelect( ( select ) => {
const { getMultiSelectedBlockClientIds } = select(
'core/block-editor'
);
const { multiSelectedBlockClientIds, isInserterVisible } = useSelect(
( select ) => {
const {
getMultiSelectedBlockClientIds,
isBlockInsertionPointVisible,
} = select( 'core/block-editor' );

return {
multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),
};
} );
return {
multiSelectedBlockClientIds: getMultiSelectedBlockClientIds(),
isInserterVisible: isBlockInsertionPointVisible(),
};
}
);

function onMouseMove( event ) {
if ( event.target.className !== className ) {
Expand Down Expand Up @@ -138,10 +142,11 @@ export default function InsertionPoint( {
const isInserterHidden = hasMultiSelection
? multiSelectedBlockClientIds.includes( inserterClientId )
: inserterClientId === selectedBlockClientId;
const isVisible = isInserterShown || isInserterForced || isInserterVisible;

return (
<>
{ ! isMultiSelecting && ( isInserterShown || isInserterForced ) && (
{ ! isMultiSelecting && isVisible && (
<Popover
noArrow
animate={ false }
Expand Down

0 comments on commit 9beb5c9

Please sign in to comment.