5

Is there a way to give oEmbed codes a special markup in the visual editor? In my dream implementation you paste an oEmbed-enabled url in the editor, which will then automatically replace it with a thumbnail of the media object you want to insert. A basic implementation would at least highlight the URL so the user knows "something special" could happen there (if no errors occur).

Is there a plugin that does this? I could create something like this myself, but I would need some pointers on how to hook into the TinyMCE editor in the most WordPress-stylish way.

3
  • Hi Jan, did you find any good solution for this by chance? I am very interested in doing the same thing but my focused would be shortcodes mainly because when you try to explain to someone these shortcodes and how they work they often time screw things up or don't understand how it works. I am also curious... if one can have the shortcode replaced with a box then should it not be possible to have the sortcode replaced with some "virtual" html or an inline iframe which contains the html? Commented Nov 19, 2010 at 13:55
  • @NetConstructor.com: I have not found anything yet, but it should be possible to do this with shortcodes. I know the [gallery] shortcode gets a nice layout when you switch from the HTML to the visual editor, probably that TinyMCE plugin could be extended to other shortcodes too.
    – Jan Fabry
    Commented Nov 19, 2010 at 14:24
  • Mental note for myself: there is commented-out code for this in the WordPress plugin for TinyMCE.
    – Jan Fabry
    Commented Feb 13, 2011 at 18:21

1 Answer 1

1

I think this might be a step in the right direction:

http://codex.wordpress.org/Plugin_API/Filter_Reference

Specifically the the_editor_content filter which is "applied to post content before putting it into a rich editor window."

Sorry I can't flesh it out more for you but I am just starting to play around with filters myself and have miles to go before I can be useful.

2
  • Thanks for the answer. I think I'll need to look at the TinyMCE events, since I also need to switch the text between the Visual and the HTML editor. For inspiration, I'm looking at the plugin that handles Flash embeds. In the HTML editor you see the embed code, in the visual editor you see a box.
    – Jan Fabry
    Commented Sep 28, 2010 at 9:40
  • Your welcome. Please post your solution here when you have it I would be very interested to see the final result Commented Sep 28, 2010 at 23:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.