WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.24k stars 4.09k forks source link

Convert embed shortcodes to embed blocks #13852

Open spacedmonkey opened 5 years ago

spacedmonkey commented 5 years ago

All the embed shortcodes found in content, should be converted to embed blocks when viewing in editor. Without this embed, the embed is not previewed.

speedwheel commented 5 years ago

This would be awesome to have.

spacedmonkey commented 5 years ago

After a chat with @swissspidy I believe this work breaks down into two pieces.

Not sure which is the best course of action here....

notnownikki commented 5 years ago

This would be really nice! We could do it for [embed]...[/embed] but would have to leave any with width or height attributes, as the embed block just puts the URL on its own line, so can't specify the width or height.

notnownikki commented 5 years ago

Just to clarify, converting the [embed] shortcodes to URLs works because we have a REST API to preview embed rendering. It would get a little messy to extract the URL from the shortcode for previewing, but still render it as a shortcode... and I don't think we have an API for previewing shortcodes?

afercia commented 5 years ago

Wanted to report the same problem and found this issue. To recap:

In the Classic Editor or in the Gutenberg classic block, an embed shortcode like the following renders a nice preview:

[embed]https://vimeo.com/22439234[/embed]

Hello this is some text.

The same applies to other embeds, for example: a tweet:

[embed]https://twitter.com/nacin/status/319508408669708289[/embed]

In Gutenberg, when converting a "classic" embed shortcode to blocks, users get this:

Screenshot 2019-06-08 at 13 38 38

Besides the fact there's no preview, which lacks parity with the classic editor, I'd say the UI is a bit unclear. I'm always in doubt what to do:

At the very least, the UI should make clear shortcodes like these have no preview at the moment. This would help users make an informed decision and, for example, just manually transform the shortcode block to an Embed block.

Of course a smarter transform with an actual preview would be very welcome 🙂