Skip to content

Conversation

@retrofox
Copy link
Contributor

@retrofox retrofox commented Sep 10, 2020

This PR adds loom.com as a new oembed provider, allowing embed resources from this service.

Changes proposed in this Pull Request:

  • Add loom.com as a new oembed provider

Jetpack product discussion

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Edit/Add a post
  • Confirm you see the Loom variation among block options.

Screen Shot 2020-09-10 at 9 28 43 PM

  • Finally, confirm the resource is properly rendered.

image

  • Confirm, you can paste the resource and it will be automatically transformed in a core/embed block, Loom variation.

Confirm it works with WordPress greater and lower than 5.5

Proposed changelog entry for your changes:

  • Add loom.com as a new oembed provider

@retrofox retrofox self-assigned this Sep 10, 2020
@retrofox retrofox added [Status] Needs Review This PR is ready for review. [Status] Needs Team Review Obsolete. Use Needs Review instead. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Shortcodes / Embeds labels Sep 10, 2020
@retrofox retrofox requested a review from a team September 10, 2020 20:38
@jetpackbot
Copy link
Collaborator

jetpackbot commented Sep 10, 2020

Scheduled Jetpack release: October 6, 2020.
Scheduled code freeze: September 29, 2020

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-17137

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Generated by 🚫 dangerJS against 7dfea16

@retrofox retrofox removed the [Status] Needs Review This PR is ready for review. label Sep 10, 2020
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello retrofox! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer and confirm D49389-code works as expected before merging this PR. Once this PR is merged, please commit the changes to WP.com. Thank you!
This revision will be updated with each commit to this PR

Copy link
Contributor

@creativecoder creativecoder left a comment

Choose a reason for hiding this comment

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

Note, I tested with different versions...

WP 5.5 plus latest Gutenberg plugin - works as expected

WP 5.5 - works as expected

WP 5.4 (previous version) - registerBlockVariation is available, but the embed block did not use variations in this version, so the block isn't available. But the embed still works through the embed block, or by pasting a loom link.

@creativecoder
Copy link
Contributor

I'm having trouble getting the embed to preview within the editor. I works fine on the front end of the site within the post/page, though.

Seems to be related to the sandbox attribute on the iframe. The iframe embed works fine pasted into an html block when I remove that attribute.

Screen Shot 2020-09-10 at 17 58 33

@retrofox
Copy link
Contributor Author

Note, I tested with different versions...

WP 5.5 plus latest Gutenberg plugin - works as expected

WP 5.5 - works as expected

WP 5.4 (previous version) - registerBlockVariation is available, but the embed block did not use variations in this version, so the block isn't available. But the embed still works through the embed block, or by pasting a loom link.

I've added a fallback for versions lower than 5.5, using the editor.registerBlockType filter. It works very well for me. it would be nice if you can check it.

@retrofox
Copy link
Contributor Author

Seems to be related to the sandbox attribute on the iframe. The iframe embed works fine pasted into an html block when I remove that attribute.

Can you provide the Loom resource (URL), please? I think it was a matter of your testing flow. Keep in mind that the HTML markup is cached and if it was not properly generated in the first attempt it will keep returning the wrong code beyond the app adds the Loop provider properly.
I say this because we are seeing the sandbox attribute. It shouldn't appear once the provider is added.

@retrofox retrofox added the [Status] Needs Review This PR is ready for review. label Sep 11, 2020
@retrofox retrofox requested a review from jeherve September 11, 2020 00:44
@creativecoder
Copy link
Contributor

Keep in mind that the HTML markup is cached and if it was not properly generated in the first attempt it will keep returning the wrong code beyond the app adds the Loop provider properly.

I think that was it. My issues were resolved when I switched to a different test site. The loom url I'm using for testing is https://www.loom.com/share/0281766fa2d04bb788eaf19e65135184

@jeherve
Copy link
Member

jeherve commented Sep 11, 2020

Do you happen to have some background on this addition?

  • Shouldn't this be added to Core directly instead?
  • In the past, we've added embeds without dealing with the block editor UI.
    <?php
    /**
    * Extra oEmbed providers that we know about and use on wpcom for feature parity.
    *
    * This file will be loaded even when you don't use the Shortcodes feature,
    * as these embeds are considered safe to use on any site
    * (and may end up embedded in Core in the future).
    *
    * @package Jetpack
    */

    (also see D49210-code for where this is managed on WordPress.com)

My first thought would be that the embed addition would be a good fit for Jetpack / WordPress.com, without a UI, until the embed makes it way into Core.

If we decide to add a UI in the editor, maybe we should do it for all our other embeds as well?

@jeherve jeherve added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Sep 11, 2020
@retrofox
Copy link
Contributor Author

retrofox commented Sep 11, 2020

Keep in mind that the HTML markup is cached and if it was not properly generated in the first attempt it will keep returning the wrong code beyond the app adds the Loop provider properly.

I think that was it. My issues were resolved when I switched to a different test site. The loom url I'm using for testing is https://www.loom.com/share/0281766fa2d04bb788eaf19e65135184

It works for me. 👍

@retrofox
Copy link
Contributor Author

retrofox commented Sep 11, 2020

Thanks, Jeremy.

  • Shouldn't this be added to Core directly instead?

We discussed a little bit about this and concluded adding this provider to Jetpack could be the whole implementation faster. It doesn't mean that we couldn't start adding Loom straight in the core but maybe in the following step?
We'd really like to implement Loom as soon as possible, and since it doesn't seem to have technical blockers for its implementation, Jetpack was the best candidate.

  • In the past, we've added embeds without dealing with the block editor UI.

Well... maybe in the past the block editor didn't exist :-D.
I put the backend code in ./extensions/extended-blocks/core-embed because, basically, we are extending the core/embed block.
Something similar happens with core/video, core/cover and core/audio. Although the extending reasons are different, in the end, we modifying blocks that are not registered by Jetpack.

<?php
/**
* Extra oEmbed providers that we know about and use on wpcom for feature parity.
*
* This file will be loaded even when you don't use the Shortcodes feature,
* as these embeds are considered safe to use on any site
* (and may end up embedded in Core in the future).
*
* @package Jetpack
*/

I didn't want to edit this file because it belongs to shortcodes. It isn't a big deal moving changes straight there.

(also see D49210-code for where this is managed on WordPress.com)

Yeah, but it's for Simple sites, correct? In that case, we'll need to add the provider to two different files?

My first thought would be that the embed addition would be a good fit for Jetpack / WordPress.com, without a UI, until the embed makes it way into Core.

That was our first thought too, but then we changed in order to reduce the landing time. Again, we can start to work on moving the whole implementation to the core. It means, if I'm not wrong, add the provider to WordPress core and also add the block variation in Gutenberg core. Is it correct?

If we decide to add a UI in the editor, maybe we should do it for all our other embeds as well?

Do you mean to add a block variation for all oEmbed blocks in Jetpack? If so, I'd happy to take over this task.

@jeherve
Copy link
Member

jeherve commented Sep 11, 2020

Related discussion:
p1599826045429400-slack-CKZHG0QCR

adding this provider to Jetpack could be the whole implementation faster. It doesn't mean that we couldn't start adding Loom straight in the core but maybe in the following step?

👍

it's for Simple sites, correct? In that case, we'll need to add the provider to two different files?

Correct, unless we were to bring files in sync in the future. Here was an exploration:

D27182-code

It means, if I'm not wrong, add the provider to WordPress core and also add the block variation in Gutenberg core. Is it correct?

Exactly. Adding an embed to Core is usually done in two patches these days: one to add it to Gutenberg, one to add it to Core. Here is an example:

Do you mean to add a block variation for all oEmbed blocks in Jetpack? If so, I'd happy to take over this task.

Yes, exactly. If we think it's a valuable addition for the Loom provider, and if you've developed the basic structure for one provider, we may as well add more in the future.

@retrofox retrofox added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Sep 23, 2020
@jeherve jeherve added this to the 9.0 milestone Sep 24, 2020
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.

This tests well. I only have one suggestion.

@jeherve jeherve added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Sep 24, 2020
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Sep 24, 2020
@retrofox retrofox merged commit d0818ca into master Sep 24, 2020
@retrofox retrofox deleted the update/add-loom-embed-extended-block branch September 24, 2020 17:20
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Sep 24, 2020
jeherve added a commit that referenced this pull request Sep 25, 2020
@jeherve
Copy link
Member

jeherve commented Oct 6, 2020

r214751-wpcom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Shortcodes / Embeds Touches WP.com Files [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants