From 8c6d51d0ff4e82e0dc88acb11737a154112e86e7 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 15 Jan 2021 11:33:30 +0100 Subject: [PATCH] Fix insertion point --- .../src/components/block-list/insertion-point.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-list/insertion-point.js b/packages/block-editor/src/components/block-list/insertion-point.js index c152b86b0b240..79faff5df3d62 100644 --- a/packages/block-editor/src/components/block-list/insertion-point.js +++ b/packages/block-editor/src/components/block-list/insertion-point.js @@ -207,7 +207,16 @@ export default function useInsertionPoint( ref ) { return; } - const rootClientId = event.target.getAttribute( 'data-block' ); + let rootClientId; + if ( ! event.target.classList.contains( 'is-root-container' ) ) { + const blockElement = event.target.classList.contains( + 'wp-block' + ) + ? event.target + : event.target.closest( '.wp-block' ); + rootClientId = blockElement.getAttribute( 'data-block' ); + } + const orientation = getBlockListSettings( rootClientId )?.orientation || 'vertical'; const rect = event.target.getBoundingClientRect();