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

Embeds: WordPress Embeds not properly previewed in Editor #25344

Closed
ockham opened this issue Sep 15, 2020 · 3 comments · Fixed by #25370
Closed

Embeds: WordPress Embeds not properly previewed in Editor #25344

ockham opened this issue Sep 15, 2020 · 3 comments · Fixed by #25370
Assignees
Labels
[Block] Embed Affects the Embed Block [Status] In Progress Tracking issues with work in progress

Comments

@ockham
Copy link
Contributor

ockham commented Sep 15, 2020

Describe the bug
WordPress Embeds are rendered quite differently in the Editor than on the frontend.

To reproduce
Steps to reproduce the behavior:

  1. Start a new post.
  2. Insert the URL of a WordPress site, e.g. https://ma.tt/2020/07/corner-office-interview/
  3. Verify that rather than the embed, only a link with the page title is inserted.

Expected behavior
The WordPress Embed should be inserted, as seen on the frontend.

Screenshots
Editor:
image

Frontend:
image

Editor version (please complete the following information):

  • WordPress version: 5.5
  • Does the website has Gutenberg plugin installed, or is it using the block editor that comes by default? gutenberg plugin
  • If the Gutenberg plugin is installed, which version is it? 8.9

Additional context
Found by @david-szabo97 here: Automattic/wp-calypso#39935 (comment). Quoting that comment:

EDIT:
TLDR: We need this patch: D48267-code
TLDR: oAuth embed auto discovery embeds the iframe

Figured it out. It's actually being embedded:
image
But you can see an inline style there on the iframe: position: absolute;clip: rect(1px, 1px, 1px, 1px); which is basically hiding the embedded content.
image

wp-embed.js is supposed to remove that inline style, but since we don't have that on WP.com, it's not happening.

So it seems we need to load that wp-embed.js in the editor to make things work? 🤔

This issue also discussed as part of #21029, and in bobbingwide/oik#158 (although with a somewhat different conclusion, IIRC).

cc/ @mcsf @ntsekouras @paaljoachim @bobbingwide

@youknowriad
Copy link
Contributor

Related #21945

@paaljoachim
Copy link
Contributor

paaljoachim commented Sep 15, 2020

Thanks for adding the issue @ockham Bernie!

What we need is to be able to view the result of the embed in the backend as we can see it on the frontend.
The ideal would probably be this process:
1- User pastes a link (that wants to create a WP embed).
2- A placeholder shows up asking if one wants an embed or convert into a text link. Kinda like the below example.
3- (Really the ideal method would be) If user selects embed then one sees the result in the backend, and should be able to modify it as if it was a group block with inner blocks. As the embed contains a lot of elements.

Here is a kind of overview....

@desaiuditd Udit has been working on embeds.
I am not really sure where we are at right now.

At the moment we can transform an embed into a Paragraph through the Transform panel.
Like so.

Screen Shot 2020-09-15 at 22 20 15

Below are various issues. I believe we need a developer to look through to see where the forward path goes. I have lost track and feel a bit lost in the forest.

Embed issues:
#21029

#21789

#15102

#20442

#18653

Merged Embed PR's:
#22846
#17413

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Sep 16, 2020
@ntsekouras
Copy link
Contributor

Great description and investigation made here!

I created a draft PR for now here: #25370 and I'll work on it (still WIP).

The ideal would probably be this process:
1- User pastes a link (that wants to create a WP embed).
2- A placeholder shows up asking if one wants an embed or convert into a text link. Kinda like the below example.
3- If user selects embed then one sees the result in the backend, and should be able to modify it as if it was a group block with inner blocks. As the embed contains a lot of elements.

@paaljoachim while this sounds good, I believe it's something for an issue of its own. It seems to be another flow for how we try to transform links to embed blocks. Thanks for adding all these information and links, and I'll take a closer look as well (I haven't for now for all of them).

I think we should prioritize in this issue about fixing the bug to have front-end/back-end rendering parity.

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 [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants