Skip to content
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

Block Library: Add a Post Excerpt block. #19579

Merged
merged 3 commits into from
Jan 13, 2020
Merged

Conversation

epiqueras
Copy link
Contributor

Description

This PR adds a new Post Excerpt block akin to the Post Title and Post Content blocks.

How has this been tested?

  • Inserted Post Excerpt block in a post.
  • Confirmed post excerpt rendered in the editor and front end.
  • Inserted Post Excerpt block in a template.
  • Confirmed post excerpt placeholder rendered in the editor and the relevant post excerpt rendered in the front end.

Types of Changes

New Feature: There is a new Post Excerpt block for template building.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.


function PostExcerptDisplay() {
const [ excerpt ] = useEntityProp( 'postType', 'post', 'excerpt' );
return <RichText.Content tagName="p" value={ excerpt } />;
Copy link
Contributor

Choose a reason for hiding this comment

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

In the sidebar of the editor, we use a TextareaControl to edit the excerpt, it makes me think we should use PlainText here. any reason for not making this editable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to be minimal with these changes by making the new blocks read-only first so that we can land them faster and then iterate.

I've changed it to use PlainText now since I agree it is more fitting, and the complexity doesn't increase much.

@youknowriad youknowriad added the Needs Design Feedback Needs general design feedback. label Jan 13, 2020

export default function PostExcerptEdit() {
if ( ! useEntityId( 'postType', 'post' ) ) {
return 'Post Excerpt Placeholder';
Copy link
Contributor

Choose a reason for hiding this comment

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

i18n

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we should use it here.

This is a temporary placeholder while #19256 is worked on.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

I noticed a focused style for the PlainText component, I don't think this was intended and was probably introduced by mistake but it's separate from that PR.

@epiqueras epiqueras requested review from nerrad and ntwb as code owners January 13, 2020 15:54
@epiqueras epiqueras merged commit 5e2ac97 into master Jan 13, 2020
@epiqueras epiqueras deleted the add/post-excerpt-block branch January 13, 2020 16:30
@ellatrix ellatrix modified the milestones: Future, Gutenberg 7.3 Jan 20, 2020
@kjellr kjellr added the New Block Suggestion for a new block label Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Feedback Needs general design feedback. New Block Suggestion for a new block
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants