Skip to content

Commit

Permalink
create a public and a private version of blockpopover
Browse files Browse the repository at this point in the history
  • Loading branch information
gigitux committed May 10, 2024
1 parent 862dc76 commit b6092cc
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ Undocumented declaration.

### BlockPopover

Undocumented declaration.
_Related_

- <https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md>

### BlockPreview

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This determines whether the block popover always shifts into the viewport or rem
- Required: No
- Default: `true`

## BlockPopoverInbetween
## BlockPopoverInbetween - Private Component

### Props

Expand Down
24 changes: 23 additions & 1 deletion packages/block-editor/src/components/block-popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,26 @@ function BlockPopover(
);
}

export default forwardRef( BlockPopover );
export const PrivateBlockPopover = forwardRef( BlockPopover );

const PublicBlockPopover = ( {
clientId,
bottomClientId,
children,
...props
} ) => (
<BlockPopover
{ ...props }
bottomClientId={ bottomClientId }
clientId={ clientId }
__unstableContentRef={ undefined }
__unstablePopoverSlot={ undefined }
>
{ children }
</BlockPopover>
);

/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-popover/README.md
*/
export default forwardRef( PublicBlockPopover );
2 changes: 2 additions & 0 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
} from './store/private-keys';
import { requiresWrapperOnCopy } from './components/writing-flow/utils';
import { PrivateRichText } from './components/rich-text/';
import { PrivateBlockPopover } from './components/block-popover';

/**
* Private @wordpress/block-editor APIs.
Expand Down Expand Up @@ -76,4 +77,5 @@ lock( privateApis, {
requiresWrapperOnCopy,
PrivateRichText,
reusableBlocksSelectKey,
PrivateBlockPopover,
} );

0 comments on commit b6092cc

Please sign in to comment.