AesopInteractive / lasso

Code Repository for Editus (formerly Lasso) Commercial Plugin
https://edituswp.com
GNU General Public License v2.0
147 stars 25 forks source link

Live oEmbed Parsing #22

Open michaelbeil opened 9 years ago

michaelbeil commented 9 years ago

Need a way to automatically turn a twitter status into an actual styled Twitter card. WordPress does this with wp ombed, maybe somehow tap into this? This should happen in real time, after the user pastes in the link.

http://cl.ly/image/1W1o3H0t3L1b

http://codex.wordpress.org/Function_Reference/wp_oembed_get

The below shortcode works by default, but I'd rather not turn it into another module if we dont have too. It would be nice to have it work off the url alone.

[embed]https://twitter.com/addyosmani/status/556113388557066240[/embed]

needs to be in real-time like the gallery shortcode hanlder needs to save the [embed]url[/embed] on save and not the actual html

rhurling commented 9 years ago

You can use the existing WordPress AJAX hook (wp_ajax_parse_embed, action: parse-embed). I started work on this here: https://github.com/rhurling/lasso/tree/live-oembed-parsing If the pasted text is an url it waits for the AJAX call to finish before pasting something in (did it that way because I couldn't figure out how to remove the already inserted link).

I can open that as a PR if there's interest. That one requires my other PR (#108) to save them as [embed]url[/embed]