From 154266a0ab1e619605c522d2691e3450aa1cefdc Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Wed, 17 Nov 2021 17:04:26 +1100 Subject: [PATCH] Export useBlockPreview as __experimentalUseBlockPreview --- packages/block-editor/README.md | 17 ----------------- packages/block-editor/src/components/index.js | 5 ++++- .../block-library/src/post-template/edit.js | 2 +- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 06acf28404dd26..94a227890243b6 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -664,23 +664,6 @@ _Returns_ Undocumented declaration. -### useBlockPreview - -This hook is used to lightly mark an element as a block preview wrapper -element. Call this hook and pass the returned props to the element to mark as -a block preview wrapper, automatically rendering inner blocks as children. If -you define a ref for the element, it is important to pass the ref to this -hook, which the hook in turn will pass to the component through the props it -returns. Optionally, you can also pass any other props through this hook, and -they will be merged and returned. - -_Parameters_ - -- _options_ `Object`: Preview options. -- _options.blocks_ `WPBlock[]`: Block objects. -- _options.props_ `Object`: Optional. Props to pass to the element. Must contain the ref if one is defined. -- _options.\_\_experimentalLayout_ `Object`: Layout settings to be used in the preview. - ### useBlockProps This hook is used to lightly mark an element as a block element. The element diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index f7128d2de06981..d349dea1725eaa 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -104,7 +104,10 @@ export { default as BlockList } from './block-list'; export { useBlockProps } from './block-list/use-block-props'; export { LayoutStyle as __experimentalLayoutStyle } from './block-list/layout'; export { default as BlockMover } from './block-mover'; -export { default as BlockPreview, useBlockPreview } from './block-preview'; +export { + default as BlockPreview, + useBlockPreview as __experimentalUseBlockPreview, +} from './block-preview'; export { default as BlockSelectionClearer, useBlockSelectionClearer as __unstableUseBlockSelectionClearer, diff --git a/packages/block-library/src/post-template/edit.js b/packages/block-library/src/post-template/edit.js index 43be5e7f1de8df..72f5afb4803c6e 100644 --- a/packages/block-library/src/post-template/edit.js +++ b/packages/block-library/src/post-template/edit.js @@ -11,7 +11,7 @@ import { useSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { BlockContextProvider, - useBlockPreview, + __experimentalUseBlockPreview as useBlockPreview, useBlockProps, useInnerBlocksProps, store as blockEditorStore,