Skip to content

Commit

Permalink
Post Excerpt: improve preview on the editor site (#50167)
Browse files Browse the repository at this point in the history
* rename post-excerpt to excerpt and update labels

* improve description

* improve warning label
  • Loading branch information
gigitux authored Jun 6, 2023
1 parent cfdbd85 commit e8e2ae3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ Add the date of this post. ([Source](https://github.com/WordPress/gutenberg/tree
- **Supports:** anchor, color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** displayType, format, isLink, textAlign

## Post Excerpt
## Excerpt

Display a post's excerpt. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-excerpt))
Display the excerpt. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/post-excerpt))

- **Name:** core/post-excerpt
- **Category:** theme
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-excerpt/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "core/post-excerpt",
"title": "Post Excerpt",
"title": "Excerpt",
"category": "theme",
"description": "Display a post's excerpt.",
"description": "Display the excerpt.",
"textdomain": "default",
"attributes": {
"textAlign": {
Expand Down
19 changes: 5 additions & 14 deletions packages/block-library/src/post-excerpt/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,7 @@ export default function PostExcerptEditor( {
/>
</BlockControls>
<div { ...blockProps }>
<p>
{ __(
'This is the Post Excerpt block, it will display the excerpt from single posts.'
) }
</p>
<p>
{ __(
'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'
) }
</p>
<p>{ __( 'This block will display the excerpt.' ) }</p>
</div>
</>
);
Expand All @@ -128,7 +119,7 @@ export default function PostExcerptEditor( {
<div { ...blockProps }>
<Warning>
{ __(
'There is no excerpt because this is a protected post.'
'The content is currently protected and does not have the available excerpt.'
) }
</Warning>
</div>
Expand Down Expand Up @@ -195,22 +186,22 @@ export default function PostExcerptEditor( {
const excerptContent = isEditable ? (
<RichText
className={ excerptClassName }
aria-label={ __( 'Post excerpt text' ) }
aria-label={ __( 'Excerpt text' ) }
value={
isSelected
? rawOrRenderedExcerpt
: ( ! isTrimmed
? rawOrRenderedExcerpt
: trimmedExcerpt + ELLIPSIS ) ||
__( 'No post excerpt found' )
__( 'No excerpt found' )
}
onChange={ setExcerpt }
tagName="p"
/>
) : (
<p className={ excerptClassName }>
{ ! isTrimmed
? rawOrRenderedExcerpt || __( 'No post excerpt found' )
? rawOrRenderedExcerpt || __( 'No excerpt found' )
: trimmedExcerpt + ELLIPSIS }
</p>
);
Expand Down

1 comment on commit e8e2ae3

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in e8e2ae3.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5187655138
📝 Reported issues:

Please sign in to comment.