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

Gist URLs within Gutenberg causing a broken embed box #10161

Open
dartiss opened this issue Sep 18, 2018 · 11 comments
Open

Gist URLs within Gutenberg causing a broken embed box #10161

dartiss opened this issue Sep 18, 2018 · 11 comments
Labels
[Feature] Shortcodes / Embeds [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] High [Type] Bug When a feature is broken and / or not performing as intended

Comments

@dartiss
Copy link

dartiss commented Sep 18, 2018

Right now, Jetpack is affecting the embedding of Gists within Gutenberg, although I've been unable to narrow it down to a specific Jetpack module (although a default set-up of Jetpack does cause this, so it's either a default module or not a specific one at all).

To recreate...

With Jetpack and Gutenberg active, try embedding a Instagram profile - these are not set up to currently embed. For example... https://www.instagram.com/lauraartiss/

This will display as a box, with the URL showing and showing "Sorry, we could not embed that content". However, try a Gist, for example https://gist.github.com/dartiss/028c0065c06b0b84a26f40038fbf47b7. This shows, instead, as a totally empty block.

Switch off Jetpack and the Gist embed will now display correctly. The attached screenshot shows both of the examples.

I've tried this on 3 different sites, all hosted on different platforms, and the same issue occurs.

screen shot 2018-09-18 at 15 05 33

@dartiss dartiss added the [Type] Bug When a feature is broken and / or not performing as intended label Sep 18, 2018
@kraftbj kraftbj added the [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack label Sep 18, 2018
@kraftbj
Copy link
Contributor

kraftbj commented Sep 18, 2018

My guess without investigating is https://github.com/Automattic/jetpack/blob/master/modules/shortcodes/gist.php . Specifically, we're calling a custom oembed handler, which just calls our shortcode handler. The shortcode handler is enqueuing JS which, I presume, isn't happening with Gutenberg's way of doing it.

Are there any errors in the console?

@dartiss
Copy link
Author

dartiss commented Sep 18, 2018

No errors @kraftbj

@BinaryMoon
Copy link
Contributor

I was about to create this exact issue. The gists show in the blog post itself but don't display in the editor. However you can select and edit them.

@jeherve
Copy link
Member

jeherve commented Nov 5, 2018

Update on this: WordPress/gutenberg#9734 has helped a bit by enqueuing the gist.min.js file our embed depends on, but we still run into a JavaScript error:

Uncaught ReferenceError: jQuery is not defined

@jeherve jeherve added this to the 6.9 milestone Nov 27, 2018
@dartiss
Copy link
Author

dartiss commented Dec 7, 2018

Unfortunately, the release of WordPress 5.0 has now made this worse, as Gist embeds no longer work at all.

With Jetpack installed under WP 5.0, I'm seeing the same behaviour as you'd expect if Jetpack wasn't installed (i.e. no support for Gist embeds). Adding a Gist URL to a post generates the "sorry, we could not embed that content” and displaying the pos then shows the Gist URL, unlinked.

This is a problem for users who have posts with Gist URLs embedded in them already, as this new behaviour breaks both new and existing posts as well.

I'm told Jetpack hasn't decommissioned Gist embeds, so it looks as if the embedding has simply broken entirely now.

@jeherve
Copy link
Member

jeherve commented Dec 7, 2018

Related: #9331

Adding a Gist URL to a post generates the "sorry, we could not embed that content” and displaying the pos then shows the Gist URL, unlinked.

I can reproduce this, but the gist embeds actually seem to work on the frontend. Is it the same on your end?

I tested with this URL:
https://gist.github.com/sebastianbenz/1d449dee039202d8b7464f1131eae449

Here is how it looks in the editor:

screenshot 2018-12-07 at 15 50 08

and on the frontend:

screenshot 2018-12-07 at 15 51 25

@dartiss
Copy link
Author

dartiss commented Dec 8, 2018

No, doesn't work for me on the front-end.

I'm testing with this Gist - https://gist.github.com/dartiss/d0d117f251cf6b9bd750c19ec9377c23

Here's my test post - https://artiss.uk/sandbox/uncategorized/new-gist-test/

@jeherve
Copy link
Member

jeherve commented Dec 10, 2018

It seems you've disabled the Shortcodes module on your site; you'll want to enable it for this to work on the front-end.

@dartiss
Copy link
Author

dartiss commented Dec 10, 2018

🤦 Yeah, you're right. I disabled it a little while ago to test a YouTube shortcode that was being overridden by the Jetpack version.

Odd. I only bought this up because a user on wp.org forums reported the same - I guess they must be in the same situation. I'll sort them out.

Thanks Jeremy.

@jeherve jeherve modified the milestones: 6.9, 7.0 Jan 2, 2019
@jeherve jeherve removed this from the 7.0 milestone Jan 21, 2019
@westonruter
Copy link
Contributor

Just noticed this bug today when trying to embed a Gist.

Can the jQuery dependency just be eliminated here?

@ohmegasquared
Copy link

I am also experiencing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Shortcodes / Embeds [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack [Pri] High [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

6 participants