From 86b81a79f70d088903de7a695e12373f848791e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= <4710635+ellatrix@users.noreply.github.com> Date: Fri, 11 Jun 2021 10:55:50 +0300 Subject: [PATCH] Drop zone: fix horizontal indicator (#32589) --- .../src/components/use-block-drop-zone/index.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/packages/block-editor/src/components/use-block-drop-zone/index.js b/packages/block-editor/src/components/use-block-drop-zone/index.js index 019f80af6d59da..62e13c9b6b0af9 100644 --- a/packages/block-editor/src/components/use-block-drop-zone/index.js +++ b/packages/block-editor/src/components/use-block-drop-zone/index.js @@ -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 ); @@ -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 );