Skip to content

Commit

Permalink
make it less broken
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Jan 10, 2024
1 parent 125e1f2 commit c9e8c11
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/block-editor/src/components/block-popover/inbetween.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function BlockPopoverInbetween( {
);
const previousElement = useBlockElement( previousClientId );
const nextElement = useBlockElement( nextClientId );
const isVertical = operation !== 'group' && orientation === 'vertical';
const isVertical = orientation === 'vertical';

const popoverAnchor = useMemo( () => {
if (
Expand Down Expand Up @@ -99,7 +99,14 @@ function BlockPopoverInbetween( {
let width = 0;
let height = 0;

if ( isVertical ) {
if ( operation === 'group' ) {
// If the operation is group, nextRect is the target to be grouped.
// Not sure if previousRect is needed here.
top = nextRect ? nextRect.top : previousRect.top;
width = nextRect ? nextRect.width : previousRect.width;
height = nextRect ? nextRect.bottom - nextRect.top : 0;
left = nextRect ? nextRect.left : previousRect.left;
} else if ( isVertical ) {
// vertical
top = previousRect ? previousRect.bottom : nextRect.top;
width = previousRect ? previousRect.width : nextRect.width;
Expand Down

0 comments on commit c9e8c11

Please sign in to comment.