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

Giphy Block Registration #10989

Merged
merged 14 commits into from
Jan 25, 2019
Merged

Giphy Block Registration #10989

merged 14 commits into from
Jan 25, 2019

Conversation

jeffersonrabb
Copy link
Contributor

@jeffersonrabb jeffersonrabb commented Dec 17, 2018

Registers the Giphy block and handles Server-Side Rendering. SSR approach is being used because IFRAME element will be stripped out of post content on WP.com. Discussion of this here: p5TWut-gm-p2.

Companion wp-calypso PR: Automattic/wp-calypso#29638

Changes proposed in this Pull Request:

  • Registers the Giphy block
  • Callback to render the Giphy block.

Testing instructions:

  • Connect Jetpack
  • Navigate to Settings->Jetpack Constants, check JETPACK_BETA_BLOCKS, and Save.
  1. Add the block
  2. Go to Giphy, find any Gif you like, copy the URL and paste into the block. The gif should show up.
  3. Paste in a Giphy URL following this syntax: http://i.giphy.com/4ZFekt94LMhNK.gif. Past the URL into the block. The gif should show up.
  4. Type any text in to the search field. DIfferent Gifs should show up for anything you search for.
  5. Verify that the text field appears when you click on the block.
  6. Verify that the text field disappears after 3.5 seconds of inactivity, unless no search text has been provided in which case it remains visible.
  7. Verify caption behaves much like the core Image block.
  8. Verify block alignment options all work as expected.

Complete testing instructions found here: Automattic/wp-calypso#29638

Changelog

  • Block editor: addition of a new Giphy block.

@matticbot
Copy link
Contributor

D22406-code. (newly created revision)

@jetpackbot
Copy link

jetpackbot commented Dec 17, 2018

Warnings
⚠️ "Proposed changelog entry" is missing for this PR. Please include any meaningful changes

This is automated check which relies on PULL_REQUEST_TEMPLATE.We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

Generated by 🚫 dangerJS against d0eb1b5

@jeherve jeherve added the [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack label Jan 9, 2019
@jeffersonrabb jeffersonrabb requested a review from sirreal January 21, 2019 14:50
@jeffersonrabb jeffersonrabb added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels Jan 21, 2019
modules/blocks.php Outdated Show resolved Hide resolved
- Remove parens around echo
- Add missing style quotes
- Use double quotes consistently
@sirreal
Copy link
Member

sirreal commented Jan 23, 2019

I pushed a commit to clean up the HTML a bit. There were some missing as well as mixed single and double quotes.

I removed the parens around the echo arguments, they're not necessary and they seem to be mostly omitted in this code base.

modules/blocks.php Outdated Show resolved Hide resolved
<iframe src="<?php echo esc_attr( $giphy_url ); ?>" title="<?php echo esc_attr( $search_text ); ?>"></iframe>
</figure>
<?php if ( $caption ) : ?>
<p class="wp-block-jetpack-giphy-caption"><?php echo wp_kses_post( $caption ); ?></p>
Copy link
Member

Choose a reason for hiding this comment

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

Highlighting for reviewers the use of wp_kses_post here.

sirreal
sirreal previously approved these changes Jan 23, 2019
Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

This looks good and tests well. I have a lingering doubt but it can be addressed in a follow-up PR.

modules/blocks.php Outdated Show resolved Hide resolved
modules/blocks.php Outdated Show resolved Hide resolved
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

I only have minor remarks about this PR (see below), but I do have some feedback about the block itself.


Should Giphy be capitalized in the block description?

image

For some reason the additional classes don't get added to the wrapper:

image

I was a bit surprised by the block icon; I would have expected it to be an image or a Giphy logo instead of this:

image

modules/blocks.php Outdated Show resolved Hide resolved
modules/blocks.php Outdated Show resolved Hide resolved
@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Jan 24, 2019
@jeffersonrabb
Copy link
Contributor Author

I was a bit surprised by the block icon; I would have expected it to be an image or a Giphy logo instead of this:

cc: @thomasguillot

@jeherve
Copy link
Member

jeherve commented Jan 24, 2019

since these all relate to wp-calypso would you mind filing as issues and I'll address them immediately?

Sure thing.

Automattic/wp-calypso#30383
Automattic/wp-calypso#30385

@jeffersonrabb
Copy link
Contributor Author

I have a lingering doubt but it can be addressed in a follow-up PR.

This "lingering doubt" is the placeholder state, correct? If so, it's addressed in: Automattic/wp-calypso#30402 and bd0a281

Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

I left one suggestion.

modules/blocks.php Show resolved Hide resolved
modules/blocks.php Show resolved Hide resolved
Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

I think this is in a good place and the serialized block structure has likely reached some stability. I think this is ready to land any time.

@jeherve jeherve added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Jan 25, 2019
@jeherve jeherve added this to the 7.0 milestone Jan 25, 2019
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

@jeherve jeherve merged commit a97470e into master Jan 25, 2019
@jeherve jeherve deleted the try/giphy branch January 25, 2019 10:08
@jeherve jeherve added [Status] Needs Testing We need to add this change to the testing call for this month's release [Status] Has Changelog and removed [Status] Needs Changelog [Status] Needs Testing We need to add this change to the testing call for this month's release labels Jan 25, 2019
jeherve added a commit that referenced this pull request Jan 25, 2019
@spacedmonkey
Copy link
Contributor

For anyone interested, I have open a ticket on core and on the gutenberg repo.

WordPress/gutenberg#13426
https://core.trac.wordpress.org/ticket/46067

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] GIF [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants