tags:

views:

729

answers:

2

I would like users to be able to copy and paste embed tags for videos (youtube, vimeo, etc) into the html editor of tinymce. I've tried every solution I can find on the internet - however tinymce always strips out any embed tags in the video embed code when I press update in the html editor.

Here is my current tinymce init script:

tinyMCE.init({
    mode: "textareas",
    valid_elements: "*[*]",
    extended_valid_elements: "embed[width|height|name|flashvars|src|bgcolor|align|play|loop|quality|allowscriptaccess|type|pluginspage]",
    theme: "advanced",
    theme_advanced_buttons1: "code",
    media_strict: false
});

If I turn off tinymce's "cleanup" functionality (cleanup : false)...which I don't want to do...then everything works as desired

I've tried many versions of extended_valid_elements and other options but found nothing that works. What am I doing wrong?

Thanks in advance, Shane

+1  A: 

For what it's worth - after much trail and error I learned that you must include the media plugin to get media_strict to work. If this is documented somewhere I must have missed it. Here is an updated init script that allowed me to insert embed tags via the html editor in tinymce:

tinyMCE.init({ 
    mode: "textareas",      
    plugins: "media",
    theme: "advanced", 
    theme_advanced_buttons1: "code", 
    media_strict: false 
}); 

This is known to work with tinymce ver 3.2.5 & 3.3.8 - but as noted below might have issues with tinymce ver 3.3.5

jskunkle
This works for me in the editor but when you submit the post data it encodes certain < and > signs as html entities. Everything I've tried in terms of the extra init parameters won't get rid of this. Any tips?
Oliver
Hey Oliver - it appears that the latest version of tinymce (3.3.5.1) breaks the above config code. A number of users on the tinymce support boards seem to have the same issue. We recently upgraded for the table support - and the youtube embed functionality stopped working. I haven't had time to fix the problem (again) - but will post the answer when I do.
jskunkle
Revisited this issue again today since our flash/video embed has been broken since we upgraded to tinymce ver 3.3.5 - Turns out upgrading to tinymce ver 3.3.8 fixed our problem. Also updated accepted answer (above) with a bit more info
jskunkle
A: 

FYI, I also have the iFrame fix if you plan in including GOOGLE MAPS for example.

extended_valid_elements: "iframe[src|width|height|name|align], embed[width|height|name|flashvars|src|bgcolor|align|play|loop|quality|allowscriptaccess|type|pluginspage]",

Etienne Dupuis