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 and youknowriad committed Jun 14, 2021
1 parent 9921f4e commit 388b7e3
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 388b7e3

Please sign in to comment.