Skip to content

Commit

Permalink
Popover: remove buffer options (#19283)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored Dec 20, 2019
1 parent 4108636 commit 56cd1df
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const FormatToolbarContainer = ( { inline, anchorRef } ) => {
noArrow
position="top center"
focusOnMount={ false }
anchorVerticalBuffer={ 6 }
anchorRef={ anchorRef }
className="block-editor-rich-text__inline-format-toolbar"
>
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before

.components-popover__content {
min-width: auto;
margin-bottom: 6px;
}

.components-toolbar {
Expand Down
25 changes: 1 addition & 24 deletions packages/components/src/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,6 @@ function computeAnchorRect(
return withoutPadding( rect, parentNode );
}

function addBuffer( rect, verticalBuffer = 0, horizontalBuffer = 0 ) {
return {
x: rect.left - horizontalBuffer,
y: rect.top - verticalBuffer,
width: rect.width + ( 2 * horizontalBuffer ),
height: rect.height + ( 2 * verticalBuffer ),
left: rect.left - horizontalBuffer,
right: rect.right + horizontalBuffer,
top: rect.top - verticalBuffer,
bottom: rect.bottom + verticalBuffer,
};
}

function withoutPadding( rect, element ) {
const {
paddingTop,
Expand Down Expand Up @@ -231,8 +218,6 @@ const Popover = ( {
focusOnMount = 'firstElement',
anchorRef,
shouldAnchorIncludePadding,
anchorVerticalBuffer,
anchorHorizontalBuffer,
anchorRect,
getAnchorRect,
expandOnMobile,
Expand Down Expand Up @@ -268,7 +253,7 @@ const Popover = ( {
}

const refresh = () => {
let anchor = computeAnchorRect(
const anchor = computeAnchorRect(
anchorRefFallback,
anchorRect,
getAnchorRect,
Expand All @@ -280,12 +265,6 @@ const Popover = ( {
return;
}

anchor = addBuffer(
anchor,
anchorVerticalBuffer,
anchorHorizontalBuffer
);

if ( ! contentRect.current ) {
contentRect.current = contentEl.getBoundingClientRect();
}
Expand Down Expand Up @@ -357,8 +336,6 @@ const Popover = ( {
getAnchorRect,
anchorRef,
shouldAnchorIncludePadding,
anchorVerticalBuffer,
anchorHorizontalBuffer,
position,
] );

Expand Down

0 comments on commit 56cd1df

Please sign in to comment.