Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ Displays the title of a post, page, or any other content-type.

- **Name:** [core/post-title](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-theme/core-block-post-title/)
- **Category:** [theme](https://developer.wordpress.org/block-editor/reference-guides/core-blocks/core-blocks-theme/)
- **Supports:** align (full, wide), anchor, background (backgroundImage, backgroundSize, gradient), color (background, gradients, link, text), dimensions (minHeight, minWidth), interactivity (clientNavigation), shadow, spacing (margin, padding), typography (fontSize, lineHeight, textAlign), ~~html~~
- **Supports:** align (full, wide), anchor, background (backgroundImage, backgroundSize, gradient), color (background, gradients, link, text), dimensions (minHeight, minWidth), interactivity (clientNavigation), shadow, spacing (margin, padding), typography (fitText, fontSize, lineHeight, textAlign), ~~html~~
- **Attributes:** isLink, level, levelOptions, linkTarget, placeholder, rel

## Preformatted
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Cover: Stop an uploaded background video on the front end when the visitor prefers reduced motion ([#83853](https://github.com/WordPress/gutenberg/pull/83853)).
- Image: Animate touch-swipe navigation in the gallery lightbox so the image follows the finger and slides off on commit, with a quick fade-in for the next image ([#79114](https://github.com/WordPress/gutenberg/pull/79114)).
- Post Navigation Link: Add background image, size, and gradient support, withheld from the empty wrapper the same way as border, shadow and spacing ([#83940](https://github.com/WordPress/gutenberg/pull/83940)).
- Post Title: Add Fit text support, so the title can resize to fill its container ([#83036](https://github.com/WordPress/gutenberg/pull/83036)).

### Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-title/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ _Defined via the [`supports`](https://developer.wordpress.org/block-editor/refer
- [`fontSize`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-fontsize): `true`
- [`lineHeight`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-lineheight): `true`
- [`textAlign`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#typography-textalign): `true`
- `fitText`: `true`
- [`interactivity`](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-supports/#interactivity):
- `clientNavigation`: `true`

Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"__experimentalTextTransform": true,
"__experimentalTextDecoration": true,
"__experimentalLetterSpacing": true,
"fitText": true,
"__experimentalDefaultControls": {
"fontSize": true
}
Expand Down
17 changes: 16 additions & 1 deletion packages/block-library/src/post-title/edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ import { createInterpolateElement } from '@wordpress/element';
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';

export default function PostTitleEdit( {
attributes: { level, levelOptions, isLink, rel, linkTarget, placeholder },
attributes: {
level,
levelOptions,
isLink,
rel,
linkTarget,
placeholder,
fitText,
},
setAttributes,
context: { postType, postId, queryId },
} ) {
Expand Down Expand Up @@ -98,6 +106,13 @@ export default function PostTitleEdit( {
onChange={ setTitle }
__experimentalVersion={ 2 }
disableLineBreaks
// Rich text only sets pre-wrap when white-space is empty,
// and it does not update that later. Inherit lets fit
// text's nowrap apply; pre-wrap restores it when fit text
// is off.
style={ {
whiteSpace: fitText ? 'inherit' : 'pre-wrap',
} }
/>
</TagName>
) : (
Expand Down
Loading