From c95cb08a43cd7b8d9c4d57107ddbe2e3fff7c80c Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 22 Apr 2022 08:48:50 +0100 Subject: [PATCH] Improve inserter position --- .../src/components/block-popover/inbetween.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/block-popover/inbetween.js b/packages/block-editor/src/components/block-popover/inbetween.js index a585e9f1172e97..40b819f1592975 100644 --- a/packages/block-editor/src/components/block-popover/inbetween.js +++ b/packages/block-editor/src/components/block-popover/inbetween.js @@ -74,9 +74,7 @@ function BlockPopoverInbetween( { if ( isVertical ) { return { - width: previousElement - ? previousElement.offsetWidth - : nextElement.offsetWidth, + width: previousRect ? previousRect.width : nextRect.width, height: nextRect && previousRect ? nextRect.top - previousRect.bottom @@ -93,9 +91,7 @@ function BlockPopoverInbetween( { return { width, - height: previousElement - ? previousElement.offsetHeight - : nextElement.offsetHeight, + height: previousRect ? previousRect.height : nextRect.height, }; }, [ previousElement, nextElement, isVertical, positionRecompute ] ); @@ -183,6 +179,7 @@ function BlockPopoverInbetween( { 'block-editor-block-popover', props.className ) } + __unstableForcePosition >