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

make it embeddable #9

Closed
smeijer opened this issue May 23, 2020 · 20 comments
Closed

make it embeddable #9

smeijer opened this issue May 23, 2020 · 20 comments
Assignees
Labels
feature New feature or request

Comments

@smeijer
Copy link
Member

smeijer commented May 23, 2020

How awesome would it be if we had an embed-mode, so users can embed the playground in the blogs they write about testing / testing-library?


Resources:

@smeijer smeijer added the feature New feature or request label May 23, 2020
@MichaelDeBoey
Copy link
Member

Let me know whenever this is possible, so I can add it as a built-in transformer for gatsby-rark-embedder 👊

@smeijer
Copy link
Member Author

smeijer commented May 24, 2020

@MichaelDeBoey, do you have idea's about how it should look? What kind of functionality you would want in embed mode?

@MichaelDeBoey
Copy link
Member

@smeijer If you look at @codesandbox or @codepen, you see it's always a miniature version of the real app.

They're both providing an oembed endpoint, which returns an object with an html key that has the embeddable iframe.

@smeijer
Copy link
Member Author

smeijer commented May 24, 2020

Thanks, I have something to read tomorrow 👍 Never heard of oembed before.

@smeijer smeijer self-assigned this May 25, 2020
@smeijer
Copy link
Member Author

smeijer commented May 27, 2020

@MichaelDeBoey , embed mode is almost done. But I'm not sure how soon I will have oembed implemented. As that requires a server side (beyond static hosting), I need to figure a few things out.

Maybe it's possible via netlify functions, but I've never worked with those before.

Preview can be seen here: https://codepen.io/smeijer/pen/yLYWZmK

@smeijer
Copy link
Member Author

smeijer commented May 27, 2020

Been working a bit more on it, I don't think that oembed will be that hard after all :)

@MichaelDeBoey
Copy link
Member

@smeijer It really looks nice!
This would be something entirely inside of an iframe I think?

@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

@MichaelDeBoey , embeddable is done!

We support oembed as well as "custom" embed:

The custom embedding can be seen here:

https://codepen.io/smeijer/pen/yLYWZmK?editors=1000

The oembed isn't really visible yet, as I don't know of any oembed validators that can render the thing without requiring a submission first, but it passes the embed.ly validator:

image

@smeijer smeijer closed this as completed May 28, 2020
@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

To answer your question, yes, it renders the thing in an iframe. It would be possible to render it in a div instead though. Would that be preferable?

The reason I used an iframe is because the playground contains user-generated HTML. So if we would render it in a div, then there might be id-attribute collisions.

@MichaelDeBoey
Copy link
Member

@smeijer Providing an iframe is perfect for me! 👊

I'll check it out later today and I'll let you know if I need some extra info or I think something isn't working like it should be 😉

@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

Please let me know when you have something working as well 😇 , can't wait to see it in action.

@MichaelDeBoey
Copy link
Member

I've created MichaelDeBoey/gatsby-remark-embedder#123 with the reason to drop it soon 😉

@MichaelDeBoey
Copy link
Member

@smeijer If you wanna take a go on it yourself btw, it can be yours 😉

@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

Do you know how to get iframely to render the embedded thing?

I know that for embed.ly we must submit an application. But I can't find anything for iframely.

@smeijer If you wanna take a go on it yourself btw, it can be yours

I can take a look. But don't wait for me if you can do it faster.

@MichaelDeBoey
Copy link
Member

Do you know how to get iframely to render the embedded thing?

I haven't worked with iframely yet, so would have to look it up myself.

I can take a look. But don't wait for me if you can do it faster.

I can probably do it faster, but I like to help people getting into the plugin.
So if you want, be my guest 😉

@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

Not really, I have plenty of other things to do. So if you can do that, it would be much appreciated.

I've just completed the application at embed.ly. Let's see how that goes.

@MichaelDeBoey
Copy link
Member

Gonna eat and I'll create a PR for Testing Playground support 🙂

@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

Support Request is running for iframely.

image

@smeijer
Copy link
Member Author

smeijer commented May 28, 2020

we're whitelisted on iframely!

image

@MichaelDeBoey
Copy link
Member

Wooohooo!! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants