Adding Flash Embed support in TinyMCE Editor
By Akbar • January 28th, 2008
Today when working on a project, which uses the TinyMCE editor to HTML editing, I needed to add support for Flash embedding. When I tried to add the OBJECT or EMBED tags in the HTML source window, these were auto removed by the TinyMCE. Hmm… ‘there must be a simple of doing it’, I thought. Sure enough, I searched the web and there was an easy way to achieve the goal. So, all you need to do is just set the “extended_valid_elements” attribute with correct tags.
Here is how I did that:
tinyMCE.init({
mode : “textareas”,
editor_selector:“mceEditor”,
theme : “advanced”,
theme_advanced_buttons1 : “bold,italic,underline,strikethrough,|,forecolor,backcolor,|,link,unlink,image,code”,
theme_advanced_buttons2 : “”,theme_advanced_buttons3 : “”,theme_advanced_buttons4 : “”,
theme_advanced_resizing : true, tab_focus : “:prev,:next”,
extended_valid_elements : “object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode]”
});
Job done. You can now insert the FLASH stuff like movies from youtube.com easily on your site.
Tags: Embed, Flash, JavaScript, Object, TinyMCE
This entry was posted
on Monday, January 28th, 2008 at 10:11 pm and is filed under JavaScript.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Feedback & Comments
17 Responses