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

Previews for Embeddable Facebook Content are not displayed #8360

Closed
7studio opened this issue Aug 1, 2018 · 9 comments
Closed

Previews for Embeddable Facebook Content are not displayed #8360

7studio opened this issue Aug 1, 2018 · 9 comments
Labels
[Block] Embed Affects the Embed Block [Feature] Blocks Overall functionality of blocks Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Milestone

Comments

@7studio
Copy link

7studio commented Aug 1, 2018

Describe the bug
When I try to use the Facebook Embed Block, the preview of a valid embeddable content is not displayed.
Plus, when I try the same thing with the classic editor, it works very well.

Maybe this issue is relative to the #5530 one.

To Reproduce
Steps to reproduce the behaviour:

  1. Create a new content.
  2. Add a Facebook Embed Block.
  3. Paste a valid content URL. E.g.: https://www.facebook.com/oohmyworld/videos/2324195200940031/
  4. See the error message "Previews for this are unavailable in the editor, sorry!".

Expected behaviour
Gutenberg should display a preview of the embedable Facebook content or at least its HTML fallback.
E.g.:

<div class="fb-post" data-href="https://www.facebook.com/oohmyworld/posts/1882552011810839" data-width="552">
	<blockquote cite="https://www.facebook.com/oohmyworld/posts/1882552011810839" class="fb-xfbml-parse-ignore">
		<p>Une petite rétrospective sur notre vie en Ecosse...</p>
		Publiée par <a href="https://www.facebook.com/oohmyworld/">Ooh My World - En Écosse et ailleurs</a> 
		sur&nbsp;<a href="https://www.facebook.com/oohmyworld/posts/1882552011810839">Dimanche 29 juillet 2018</a>
	</blockquote>
</div>

If for some security issues, you don't want to embed external scripts into Embeds Block Previews, you are able to add the omitscript parameter to the Facebook API endpoint: https://developers.facebook.com/docs/plugins/oembed-endpoints?locale=en_GB#parameters

Screenshots

Previews for Embeddable Facebook Content are not displayed

Additional note

  • I have no error message in browser console;
  • The response of the REST route /oembed/1.0/proxy is valid;
  • The transient to cache the REST response is correctly saved.
@danielbachhuber danielbachhuber added the [Feature] Blocks Overall functionality of blocks label Aug 1, 2018
@danielbachhuber
Copy link
Member

Related #8361 (comment)

I think there's some difference between how Facebook posts are embedded within the Classic Editor vs. Gutenberg, which makes them not work in Gutenberg.

@danielbachhuber danielbachhuber added the REST API Interaction Related to REST API label Aug 1, 2018
@7studio
Copy link
Author

7studio commented Aug 2, 2018

Thank you for your answer Daniel ☺️

I'm not sure there is a difference between the Classic Editor and Gutenberg about Facebook oEmbed insertion. Plus, it is really stange that other services work and Facebook doesn't 😕

I hope Facebook oEmbeds will work when Gutenberg will be inserted in WordPress core.

@7studio
Copy link
Author

7studio commented Aug 3, 2018

I took the time to look into core-blocks/embed and the Sandbox component and now I understand why Facebook contents can't be included. There are so many differences between Gutenberg and Classic editor. I'm sorry for my quick previous answer.

Can you explain to me why the embeds are sandboxed? They are not in the classic editor and in front-end.

@danielbachhuber
Copy link
Member

I took the time to look into core-blocks/embed and the Sandbox component and now I understand why Facebook contents can't be included. There are so many differences between Gutenberg and Classic editor. I'm sorry for my quick previous answer.

No worries! Glad you were able to come to some understanding.

Can you explain to me why the embeds are sandboxed? They are not in the classic editor and in front-end.

I don't know off the top of my head, to be honest. It may be related to admin authentication cookies; the Classic Editor TinyMCE instance exists within an <iframe>, and frontend rendering doesn't have access to /wp-admin/ cookies. I'm sure there's some rationale for it though.

@notnownikki notnownikki added the [Block] Embed Affects the Embed Block label Oct 4, 2018
@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Oct 18, 2018
@danielbachhuber danielbachhuber added [Type] Enhancement A suggestion for improvement. and removed REST API Interaction Related to REST API labels Oct 18, 2018
@danielbachhuber
Copy link
Member

Removing the REST API Interaction label because this doesn't need any changes from the REST API.

@thebud15
Copy link

Reported in #10653779-hc with follow up at #1913555-zen

@renatonascalves
Copy link

@danielbachhuber Just to confirm, the preview is a no-no?

@danielbachhuber
Copy link
Member

@renatonascalves I don't recall exactly. If I were to look into this again, I'd first see if it was possible to cleanly sandbox the embed within an <iframe> (keeping in mind that it will need to resize responsively). If it doesn't look like it would be feasible, then I'd look at clarifying the error message (specifically for Facebook) to explain why the embed doesn't work within the editor.

@noisysocks noisysocks added the Needs Dev Ready for, and needs developer efforts label Oct 31, 2019
@skorasaurus
Copy link
Member

This can be closed since facebook is no longer supported in the embed block because of their api changes. 87c4dc5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Embed Affects the Embed Block [Feature] Blocks Overall functionality of blocks Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

9 participants