-
Notifications
You must be signed in to change notification settings - Fork 800
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
Pinterest block #13905
Pinterest block #13905
Conversation
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: December 3, 2019. |
Tested with single pins, boards and users ✅ Code looks good, just a few minor comments. Might be interesting to see if we can generalise some of this in the future if we end up with a bunch of embed blocks.... |
Works pretty well. The only issue I had was when I tried to use a link generated from a Pin's Share menu. Here's an example: It fails gracefully, but doesn't tell me what I need to do to share the pin. |
Double checked. This needs a preview. You can see an example of how to add a preview here: https://github.com/Automattic/jetpack/blob/master/extensions/blocks/gif/index.js#L61 The preview will show up when hovering over the block using the Block Inserter in the Top Bar. |
I think there's a |
Thanks for the reviews, everyone! I'll work through the feedback today. 🙂
We can do one better, and handle it in Core (WordPress/gutenberg#13490). I can definitely see it being a helpful equivalent of Core's older PHP-based embed registering APIs. |
Is there some magic in Jetpack that automatically registers shortcodes? It isn't registered in |
Added a block preview in 5fffbb876. Note that the vertical alignment is weird due to WordPress/gutenberg#18134. |
Good catch, thanks @MichaelArestad! I'm going to have to think about this a bit more: it currently won't work, as we need the full URL to determine what kind of embed it is. But, we can't get the full URL without a call to the server to resolve it (which is possible, but sub-optimal, since it would stop us from adding this block to the block directory). |
@pento NICE PREVIEW. The alignment thing is a bummer, but I suspect that will get fixed up as it likely will be a common problem. |
d702bf37f is a fairly wild solution for supporting The Pinterest block is able to wait for the response, then replace the I'd appreciate a sanity check on whether this is overkill or not. It's worth noting that, due to CORS rules, it's not possible to find the redirect destination from the browser, it has to be done from the server. @tellyworth: Could I get your thoughts on whether the PHP used in this block is appropriate for the block directory? The two uses are the new REST API endpoint I just added, and |
3cf9415
to
18e4911
Compare
Although it's in the |
Caution: This PR has changes that must be merged to WordPress.com |
D35021-code should get us started. You'll need to add the new files to the diff manually though, as Fusion does not yet support auto-adding new files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I only have 4 questions / remarks below. I think those could be addressed in a follow-up PR.
For some reason in some scenarios the API call was using an undefined
value instead of the URL, and I received no useful error message in the interface to let me know that something had failed. Trying again immediately worked:
https://videopress.com/v/HE2udtWu
Maybe as a V2 we could add a size option to the block sidebar, since Pinterest apparently allows you to set a data-pin-width
attribute to control the size of the embed.
I could also imagine some folks wanting to show more of their board instead of the first 700px of it or so, but I am not sure that's an option offered by Pinterest.
_inc/lib/core-api/wpcom-endpoints/class-wpcom-rest-api-v2-endpoint-resolve-redirect.php
Show resolved
Hide resolved
Well, that was an interesting reminder of how React batches state updates together. 🙂 Fixed in 794137c.
Yah, I agree that additional options probably fall under a V2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good now. 👍
@pento If you'd like to see wider testing of the new block to get more feedback, you can follow the instructions and template from PCYsg-iiu-p2 (See testing section) to post a call for testing. |
Thanks, @jeherve! I'm going to leave the call for testing for a little bit, since I'm also discussing with the Pinterest team the possibility of them adding an oEmbed endpoint: if they're able to do that before the Jetpack 8.0 code freeze, I'll re-work this block a bit to use that method for embedding, instead. Since that would require a whole new round of testing, I'd prefer to not put out two calls for testing on the same thing. 🙂 |
As a side note, I sent a follow up to Pinterest so that we can get a definitive direction on this shortly. |
* 8.0 Release: running changelog * Changelog: add #13921 * Changelog: add #13980 * Changelog: add #13905 * Changelog: add #13971 * Changelog: add #13984 * Changelog: add #14009 * Changelog: add #13620 * Remove things that will ship in 7.9.1 * Changelog: add 7.9.1 release (#14044) * Changelog: add base for 7.9.1 release * Update release date and post link * Changelog: add #14066 * Update changelog for 7.9.1 * Changelog: add #13405 * Changelog: add #13841 * Changelog: add #13924 * Changelog: add #13986 * Changelog: add #14010, #14028, #14053, #14055. * Changelog: add #14054 * Changelog: add #14031 * Changelog: add #14039 * Changelog: add #14050 * Changelog: add #14070 * Changelog: add #14082 * Changelog: add #14084 * Changelog: add #14111 * Changelog: add #13961 * Changelog: add #14047 * Changelog: add #14091 * Changelog: add #14108 * Changelog: add #14121
This PR adds a Pinterest block, providing block-editor native equivalent functionality of the existing Pinterest embed.
It includes the ability to automatically embed Pinterest URLs that are pasted into the editor, and it can convert Pinterest embeds in the Classic block to Pinterest blocks.
Changes proposed in this Pull Request:
jetpack/pinterest
.Is this a new feature or does it add/remove features to an existing part of Jetpack?
This is an existing feature being ported to the block editor.
Internal reference: pb5gDS-af-p2
Testing instructions:
This is currently marked as a beta block, you will need to add
define( 'JETPACK_BETA_BLOCKS', true );
to yourwp-config.php
file.Proposed changelog entry for your changes: