WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.4k stars 4.16k forks source link

Block Editor: `BlockCanvas` component is exposed on both public/private #61041

Closed t-hamano closed 2 months ago

t-hamano commented 5 months ago

I noticed that BlockCanvas component is exposed on both public/private.

https://github.com/WordPress/gutenberg/blob/1f6fec6575ca4e9bcd64822b533df9f3057b9ba1/packages/block-editor/src/components/index.js#L19

https://github.com/WordPress/gutenberg/blob/1f6fec6575ca4e9bcd64822b533df9f3057b9ba1/packages/block-editor/src/private-apis.js#L47

In other words, we can use this component in either of the following ways:

import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { unlock } from '../../lock-unlock';
const { ExperimentalBlockCanvas: BlockCanvas } = unlock( blockEditorPrivateApis );
import { BlockCanvas } from '@wordpress/block-editor';

Private API may be deleted.

andreiglingeanu commented 4 months ago

I see in the customize-widgets package it is used as a private API. Should that be changed there too?

t-hamano commented 3 months ago

@andreiglingeanu Thanks for the reply.

If it makes sense to remove a private API, I think we need to replace it with a public API in any components that import it.

t-hamano commented 2 months ago

After looking deeper into this issue, I found that BlockCanvas and ExperimentalBlockCanvas are not exactly the same.

BlockCanvas is a wrapper component for ExperimentalBlockCanvas, but the ExperimentalBlockCanvas component can receive more props. See this file.

At this point, I don't think it's possible to integrate these two components, so I'd like to close this issue.