Repository navigation
Post summary: Show placeholders for an empty excerpt and a missing author #85842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
787f90e
86649ad
97b744d
3b87e80
499cc30
ef7b9f2
020635b
afaa5d6
e26862b
2e967eb
44bb0e1
837d757
c18fa15
27a14bc
00d15f8
af6cdd9
ffc2c77
26194ec
c53d353
3cee79d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| https://github.com/WordPress/wordpress-develop/pull/15120 | ||
|
|
||
| * https://github.com/WordPress/gutenberg/pull/85842 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { decodeEntities } from '@wordpress/html-entities'; | ||
| import { __ } from '@wordpress/i18n'; | ||
| import { Link, Text } from '@wordpress/ui'; | ||
| import { Link } from '@wordpress/ui'; | ||
| import type { FieldsScriptParts } from '../../types'; | ||
| import styles from './style.module.css'; | ||
|
|
||
|
|
@@ -22,14 +22,15 @@ export const fieldExtensions: FieldsScriptParts< PostWithExcerpt >[ string ] = { | |
| { __( 'Learn more about manual excerpts' ) } | ||
| </Link> | ||
| ), | ||
| // Shows the first three lines of the excerpt. | ||
| // Shows the first three lines of the excerpt, as plain text that takes the | ||
| // typography of where it renders, like the values of other fields. | ||
| render: ( { item } ) => { | ||
| const excerpt = | ||
| typeof item.excerpt === 'string' ? item.excerpt : item.excerpt?.raw; | ||
| return excerpt ? ( | ||
| <Text className={ styles.excerpt }> | ||
| <span className={ styles.excerpt }> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing from |
||
| { decodeEntities( excerpt ) } | ||
| </Text> | ||
| </span> | ||
| ) : null; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,8 @@ | |
| opacity: 1; | ||
| } | ||
|
|
||
| .dataforms-layouts-panel__field-label { | ||
| .dataforms-layouts-panel__field-label, | ||
| .dataforms-layouts-panel__field-placeholder { | ||
| color: var(--wpds-color-foreground-interactive-brand); | ||
| } | ||
| } | ||
|
|
@@ -155,6 +156,27 @@ | |
| } | ||
| } | ||
|
|
||
| // A placeholder stands in for an empty value, so it is muted by color. It keeps | ||
| // the emphasized weight of values, the cue that the row is editable, which is | ||
| // all that tells it apart from the label when forced colors replace the color. | ||
| .dataforms-layouts-panel__field-placeholder { | ||
| color: var(--wpds-color-foreground-content-neutral-weak); | ||
| } | ||
|
|
||
| // Wraps the render output of a value followed by its placeholder, without | ||
| // adding a box of its own. | ||
| .dataforms-layouts-panel__field-value { | ||
| display: contents; | ||
|
|
||
| > * { | ||
| min-width: 0; | ||
| } | ||
|
|
||
| &:not(:empty) + .dataforms-layouts-panel__field-placeholder { | ||
| display: none; | ||
| } | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is connected with the changes in I tried alternatives such as moving the decision to the field render: this is unsatisfactory because we only want the placeholder when in the panel mode and only if the |
||
|
|
||
| .dataforms-layouts-panel__field-trigger--label-top | ||
| .dataforms-layouts-panel__field-label { | ||
| width: 100%; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.