Gutenberg: Text block: Oembed URLs directly

Created on 6 Jun 2017  路  7Comments  路  Source: WordPress/gutenberg

In the WordPress editor currently, if you paste a URL on an empty line and press enter, if it's an oembed supported URL, it will be embedded.

We have a great embed block for this, which helps address the mystery meat of "paste and hope".

It would be nice if in addition to the embed block, the old oembed behavior also worked.

Gutenberg Plugin [Type] Enhancement [Type] Task

Most helpful comment

@jasmussen as I was exploring the WordPress post embed type, I was thinking this exact thing.

All 7 comments

@jasmussen as I was exploring the WordPress post embed type, I was thinking this exact thing.

Once the text patterns are in, we might be able to combine it with that. It would be nice to have some front end regular expressions so we know immediately if it's an embed and what kind of embed it is.

I think I'll have to modify the patterns plugin a bit so it can handle patterns that shouldn't rely on space or enter. This feature is a use case, the / + search short cut for the inserter is another.

I would love if pasting a URL into an empty block converted that into an embed block, or whatever that means behind the scenes :) And I guess added another empty block below or something, in terms of interaction / continuing to type.

Yeah there's three options:

  • Closest to core: we embed right away and the block becomes focussed. Pressing enter creates a new paragraph block. This is what I had in mind.
  • We embed on paste + enter. End result is still the embed block + paragraph block.
  • We embed right away and insert a paragraph block immediately as well.

Of all three I think the first makes most sense.

The first makes sense to me, although I think I'd have to try it - my initial thought was "maybe I'll be scared I'm about to delete the thing I just created if I press enter while it's selected" but that might not be the case in practice. Anyway, all I really want is for your magical embeds to return :)

Was this page helpful?
0 / 5 - 0 ratings