Skip to content

Commit

Permalink
Drop zone: fix horizontal indicator (#32589)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Jun 11, 2021
1 parent 045f329 commit 86b81a7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions packages/block-editor/src/components/use-block-drop-zone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,15 @@ export default function useBlockDropZone( {
} = {} ) {
const [ targetBlockIndex, setTargetBlockIndex ] = useState( null );

const { isLockedAll, orientation } = useSelect(
const isLockedAll = useSelect(
( select ) => {
const { getBlockListSettings, getTemplateLock } = select(
blockEditorStore
);
return {
isLockedAll: getTemplateLock( targetRootClientId ) === 'all',
orientation: getBlockListSettings( targetRootClientId )
?.orientation,
};
const { getTemplateLock } = select( blockEditorStore );
return getTemplateLock( targetRootClientId ) === 'all';
},
[ targetRootClientId ]
);

const { getBlockListSettings } = useSelect( blockEditorStore );
const { showInsertionPoint, hideInsertionPoint } = useDispatch(
blockEditorStore
);
Expand All @@ -114,7 +109,7 @@ export default function useBlockDropZone( {
const targetIndex = getNearestBlockIndex(
blockElements,
{ x: event.clientX, y: event.clientY },
orientation
getBlockListSettings( targetRootClientId )?.orientation
);

setTargetBlockIndex( targetIndex === undefined ? 0 : targetIndex );
Expand Down

0 comments on commit 86b81a7

Please sign in to comment.