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

Block Library: Add a Post Excerpt block. #19579

merged 3 commits into from Jan 13, 2020

Conversation

@epiqueras
Copy link
Contributor

epiqueras commented Jan 11, 2020

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 } />;

This comment has been minimized.

Copy link
@youknowriad

youknowriad Jan 13, 2020

Contributor

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?

This comment has been minimized.

Copy link
@epiqueras

epiqueras Jan 13, 2020

Author Contributor

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.


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

This comment has been minimized.

Copy link
@youknowriad

youknowriad Jan 13, 2020

Contributor

i18n

This comment has been minimized.

Copy link
@epiqueras

epiqueras Jan 13, 2020

Author Contributor

I don't think we should use it here.

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

Copy link
Contributor

youknowriad left a comment

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 Jan 13, 2020
@epiqueras epiqueras merged commit 5e2ac97 into master Jan 13, 2020
2 checks passed
2 checks passed
pull-request-automation
Details
Travis CI - Pull Request Build Passed
Details
@epiqueras epiqueras added this to Done in Phase 2 via automation Jan 13, 2020
@epiqueras epiqueras deleted the add/post-excerpt-block branch Jan 13, 2020
@epiqueras epiqueras mentioned this pull request Jan 13, 2020
3 of 9 tasks complete
@ellatrix ellatrix modified the milestones: Future, Gutenberg 7.3 Jan 20, 2020
@karmatosed karmatosed added this to Done in Full site editing Feb 4, 2020
@kjellr kjellr added the New Block label Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Phase 2
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.