From 6c3b96a078d38d7a044f25964296abf446419775 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Thu, 8 Aug 2024 16:18:19 +0800 Subject: [PATCH] Allow margin reset on inline popover via inline styles --- .../block-editor/src/components/grid/grid-visualizer.js | 1 + packages/components/src/popover/index.tsx | 7 ++++++- packages/components/src/popover/types.ts | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/grid/grid-visualizer.js b/packages/block-editor/src/components/grid/grid-visualizer.js index 6296b5280e7f5..25c274d39d466 100644 --- a/packages/block-editor/src/components/grid/grid-visualizer.js +++ b/packages/block-editor/src/components/grid/grid-visualizer.js @@ -90,6 +90,7 @@ const GridVisualizerGrid = forwardRef( 'is-dropping-allowed': isDroppingAllowed, } ) } clientId={ gridClientId } + contentStyle={ { margin: 0 } } >
= shouldAnimate ? { style: { + ...contentStyle, ...motionInlineStyles, ...style, }, @@ -378,7 +380,10 @@ const UnforwardedPopover = ( } : { animate: false, - style, + style: { + ...contentStyle, + ...style, + }, }; // When Floating UI has finished positioning and Framer Motion has finished animating diff --git a/packages/components/src/popover/types.ts b/packages/components/src/popover/types.ts index 427f4afb81bfb..c2ceb0450b73b 100644 --- a/packages/components/src/popover/types.ts +++ b/packages/components/src/popover/types.ts @@ -160,6 +160,13 @@ export type PopoverProps = { * @default false */ inline?: boolean; + /** + * Styles to apply to the main popover element. + * + * @default undefined + */ + contentStyle?: React.CSSProperties; + // Deprecated props /** * Prevent the popover from flipping and resizing when meeting the viewport