Skip to content

Commit

Permalink
Export useBlockDisplayTitle as experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Jul 12, 2022
1 parent 77b2a57 commit a5ced2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
20 changes: 0 additions & 20 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -691,26 +691,6 @@ _Returns_

- `?WPBlockDisplayInformation`: Block's display information, or `null` when the block or its type not found.

### useBlockDisplayTitle

Returns the block's configured title as a string, or empty if the title
cannot be determined.

_Usage_

```js
useBlockDisplayTitle( 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', 17 );
```

_Parameters_

- _clientId_ `string`: Client ID of block.
- _maximumLength_ `number|undefined`: The maximum length that the block title string may be before truncated.

_Returns_

- `?string`: Block title.

### useBlockEditContext

The `useBlockEditContext` hook provides information about the block this hook is being used in.
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export {
export { default as BlockSettingsMenu } from './block-settings-menu';
export { default as BlockSettingsMenuControls } from './block-settings-menu-controls';
export { default as BlockTitle } from './block-title';
export { default as useBlockDisplayTitle } from './block-title/use-block-display-title';
export { default as __experimentalUseBlockDisplayTitle } from './block-title/use-block-display-title';
export { default as BlockToolbar } from './block-toolbar';
export { default as BlockTools } from './block-tools';
export {
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/template-part/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { useSelect } from '@wordpress/data';
import {
BlockSettingsMenuControls,
useBlockProps,
useBlockDisplayTitle,
Warning,
store as blockEditorStore,
__experimentalUseBlockDisplayTitle as useBlockDisplayTitle,
__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,
__experimentalUseBlockOverlayActive as useBlockOverlayActive,
} from '@wordpress/block-editor';
Expand Down Expand Up @@ -82,7 +82,7 @@ export default function TemplatePartEdit( {
},
[ templatePartId, clientId ]
);
const blockTitle = useBlockDisplayTitle( clientId, 25 );
const blockTitle = useBlockDisplayTitle( { clientId, maximumLength: 25 } );
const { templateParts } = useAlternativeTemplateParts(
area,
templatePartId
Expand Down

0 comments on commit a5ced2b

Please sign in to comment.