Gutenberg: Add Block: Twitter Embed

Created on 3 May 2017  路  10Comments  路  Source: WordPress/gutenberg

Looking at a Twitter embed block. I've mocked up a few states for this, and wanted to open this up for discussion.

Empty Block:
Need an empty field to paste in the Twitter embed HTML.
twitter-empty

Neutral:
I imagine the styling would be structured similarly to the blockquote styling.
twitter-neutral

Hover:
twitter-hover

Selected:
When selected the switcher would reveal it as a Twitter embed and not a blockquote. The 'edit' button would be to allow the user to click back to the 'empty' state to edit the HTML embed code or update it.
twitter-selected

[Feature] Blocks

Most helpful comment

Nice work.

Should we maybe pull it back a bit, though? I think we can just make a thin shell wrapper for the existing oembed feature. That would essentially only require a URL to the tweet in the wrapper, and we just let Twitter show us their standard embed stuff inside an iframe, like this:

screen shot 2017-05-04 at 10 03 06

All 10 comments

Nice work.

Should we maybe pull it back a bit, though? I think we can just make a thin shell wrapper for the existing oembed feature. That would essentially only require a URL to the tweet in the wrapper, and we just let Twitter show us their standard embed stuff inside an iframe, like this:

screen shot 2017-05-04 at 10 03 06

I love the idea of just keeping the OG styling from Twitter (and any other embed for that matter). After some discussion, I also realized that our Editor doesn't need the embed code, but can just work from the URL itself. So I made some changes around that as well.

Empty Selected UI
twitter no-style-empty-selected

Neutral
twitter no-style-neutral

Hover UI
twitter no-style-hover

Selected UI
twitter no-style-selected

Looks great!

I agree that keeping the standard styles is the best option.

Going to pick up this ticket.

I thought @notnownikki was already working on this?

I am :)

I have it working from just the tweet URL, it used the Twitter embed API to fetch the html. I'm just working on sandboxing the returned html in the editor, and it's pretty much done

@notnownikki okay, sounds good. Reassigning.

The mockups here are appreciated :) I've been doing more API interaction code than UI work so far (there'll be a reusable <Sandbox> component for us to sandbox third party html in the editor) so the UI thinking here helps me a lot :)

I'm closing this in favor of #1034, and because the embed block as inspired by this is in!

Was this page helpful?
0 / 5 - 0 ratings