Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Mark internal layout APIs private
  • Loading branch information
tellthemachines committed Jun 15, 2023
commit c1ff0a2d81107de9e13ac027ca746a60fbf5b6c1
31 changes: 0 additions & 31 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,6 @@ _Related_

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

### LayoutStyle

Undocumented declaration.

### LineHeightControl

_Related_
Expand Down Expand Up @@ -841,33 +837,6 @@ _Parameters_
- _props_ `Object`: Optional. Props to pass to the element. Must contain the ref if one is defined.
- _options_ `Object`: Optional. Inner blocks options.

### useLayoutClasses

Generates the utility classnames for the given block's layout attributes.

_Parameters_

- _blockAttributes_ `Object`: Block attributes.
- _blockName_ `string`: Block name.

_Returns_

- `Array`: Array of CSS classname strings.

### useLayoutStyles

Generates a CSS rule with the given block's layout styles.

_Parameters_

- _blockAttributes_ `Object`: Block attributes.
- _blockName_ `string`: Block name.
- _selector_ `string`: A selector to use in generating the CSS rule.

_Returns_

- `string`: CSS rule.

### useSetting

Hook that retrieves the given setting for the block instance in use.
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export { default as __experimentalUseResizeCanvas } from './use-resize-canvas';
export { default as BlockInspector } from './block-inspector';
export { default as BlockList } from './block-list';
export { useBlockProps } from './block-list/use-block-props';
export { LayoutStyle } from './block-list/layout';
export { default as BlockMover } from './block-mover';
export {
default as BlockPreview,
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export {
getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,
getGapCSSValue as __experimentalGetGapCSSValue,
useCachedTruthy,
useLayoutClasses,
useLayoutStyles,
} from './hooks';
export * from './components';
export * from './elements';
Expand Down
5 changes: 5 additions & 0 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { useShouldContextualToolbarShow } from './utils/use-should-contextual-to
import { cleanEmptyObject } from './hooks/utils';
import { useBlockEditingMode } from './components/block-editing-mode';
import BlockQuickNavigation from './components/block-quick-navigation';
import { LayoutStyle } from './components/block-list/layout';
import { useLayoutClasses, useLayoutStyles } from './hooks';

/**
* Private @wordpress/block-editor APIs.
Expand All @@ -28,4 +30,7 @@ lock( privateApis, {
cleanEmptyObject,
useBlockEditingMode,
BlockQuickNavigation,
LayoutStyle,
useLayoutClasses,
useLayoutStyles,
} );
9 changes: 6 additions & 3 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
WritingFlow,
BlockList,
BlockTools,
LayoutStyle,
store as blockEditorStore,
__unstableUseBlockSelectionClearer as useBlockSelectionClearer,
__unstableUseTypewriter as useTypewriter,
Expand All @@ -27,8 +26,7 @@ import {
__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,
__unstableIframe as Iframe,
__experimentalRecursionProvider as RecursionProvider,
useLayoutClasses,
useLayoutStyles,
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { useEffect, useRef, useMemo } from '@wordpress/element';
import { __unstableMotion as motion } from '@wordpress/components';
Expand All @@ -41,6 +39,11 @@ import { store as coreStore } from '@wordpress/core-data';
* Internal dependencies
*/
import { store as editPostStore } from '../../store';
import { unlock } from '../../lock-unlock';

const { LayoutStyle, useLayoutClasses, useLayoutStyles } = unlock(
blockEditorPrivateApis
);

const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;

Expand Down