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
4 changes: 4 additions & 0 deletions packages/dataviews/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- DataViews: Use intersectionObserver to improve performance by unloading invisible items. Change how infinite scroll is enabled to require only 2 view properties: `infiniteScrollEnabled` and `startPosition`. [#74378](https://github.com/WordPress/gutenberg/pull/74378)
- DataForm: The card layout now uses `Card` and `CollapsibleCard` from `@wordpress/ui` instead of `Card`, `CardHeader`, and `CardBody` from `@wordpress/components`. This changes the card's visual appearance (spacing, typography, and removal of the header/content separator). Custom CSS targeting `.components-card__body` within DataViews has been removed. Consumers wrapping DataViews or DataForm in a card should migrate to the `Card` and `CollapsibleCard` components from `@wordpress/ui`. [#76282](https://github.com/WordPress/gutenberg/pull/76282)

### Enhancements

- DataViews: Field's description can accept ReactElements. [#76829](https://github.com/WordPress/gutenberg/pull/76829)

## 13.1.0 (2026-03-18)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion packages/dataviews/src/types/field-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export type Field< Item > = {
/**
* A description of the field.
*/
description?: string;
description?: string | ReactElement;

/**
* Placeholder for the field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const form = {
labelPosition: 'none',
},
},
'excerpt',
{
id: 'status',
label: __( 'Status' ),
Expand Down
4 changes: 4 additions & 0 deletions packages/editor/src/dataviews/store/private-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
resetPost,
deletePost,
duplicateTemplatePart,
excerptField,
featuredImageField,
dateField,
parentField,
Expand Down Expand Up @@ -267,6 +268,9 @@ export const registerPostTypeSchema =
! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&
scheduledDateField,
slugField,
! DESIGN_POST_TYPES.includes( postTypeConfig.slug ) &&
postTypeConfig.supports?.excerpt &&
excerptField,
postTypeConfig.supports?.[ 'page-attributes' ] && parentField,
postTypeConfig.supports?.comments && commentStatusField,
postTypeConfig.supports?.trackbacks && pingStatusField,
Expand Down
4 changes: 4 additions & 0 deletions packages/fields/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ Duplicate action for BasePost.

Duplicate action for TemplatePart.

### excerptField

Excerpt field for BasePost.

### exportPattern

Export action as JSON for Pattern.
Expand Down
57 changes: 57 additions & 0 deletions packages/fields/src/fields/excerpt/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* WordPress dependencies
*/
import type { Field } from '@wordpress/dataviews';
import { decodeEntities } from '@wordpress/html-entities';
import { __ } from '@wordpress/i18n';
import {
ExternalLink,
__experimentalText as Text,
} from '@wordpress/components';

/**
* Internal dependencies
*/
import type { BasePost } from '../../types';

const excerptField: Field< BasePost > = {
id: 'excerpt',
type: 'text',
label: __( 'Excerpt' ),
placeholder: __( 'Add an excerpt' ),
description: (
<ExternalLink
href={ __(
'https://wordpress.org/documentation/article/page-post-settings-sidebar/#excerpt'
) }
>
{ __( 'Learn more about manual excerpts' ) }
</ExternalLink>
),
render: ( { item } ) => {
let excerpt;
if ( typeof item.excerpt === 'string' ) {
excerpt = !! item.excerpt
? decodeEntities( item.excerpt )
: __( 'Add an excerpt' );
} else {
excerpt = decodeEntities( item.excerpt?.raw || '' );
}
return (
<Text align="left" numberOfLines={ 4 } truncate>
{ excerpt }
</Text>
);
},
Edit: {
control: 'textarea',
rows: 4,
},
enableSorting: false,
filterBy: false,
};

/**
* Excerpt field for BasePost.
*/
export default excerptField;
1 change: 1 addition & 0 deletions packages/fields/src/fields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export { default as dateField } from './date';
export { default as scheduledDateField } from './date/scheduled';
export { default as authorField } from './author';
export { default as notesField } from './notes';
export { default as excerptField } from './excerpt';
export { default as formatField } from './format';
export { default as postContentInfoField } from './post-content-info';
1 change: 1 addition & 0 deletions packages/fields/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export interface PostType {
supports?: {
'page-attributes'?: boolean;
title?: boolean;
excerpt?: boolean;
revisions?: boolean;
author?: string;
thumbnail?: string;
Expand Down
Loading