1

Topic: Media plugin trouble when save YouTube url

Hi everybody,

I've some trouble with 3.2.5 TinyMCE and Media Plugin to insert YouTube url...

The trouble appears only after my form submit:

1- open Media Editor
2- paste YouTube url (e.g. http://www.youtube.com/v/_OHIH8DOLH8)
3- see Preview perfectly
4- click on Insert button
5- see yellow box for video in my editor perfectly
6- view HTML source immediately and the code is OK:

<p>
<object height="350" width="425" data="http://www.youtube.com/v/_OHIH8DOLH8" type="application/x-shockwave-flash">
<param name="src" value="http://www.youtube.com/v/_OHIH8DOLH8" />
</object>
</p>

7- valid my form to save text in my database
8- TinyMCE remove <object> tags and keep only the <param> tag in my database record
9- finally, once my editor is reloaded, nothing is displayed and if I click on "HTML source" button, there is just a <span> tag like that, instead of the <param> tag:

<span name="src" value="http://www.youtube.com/v/_OHIH8DOLH8"> </span>

Here is my Tinymce init:

theme : "advanced",
            plugins : "safari,style,layer,save,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",


            // Theme options
            theme_advanced_buttons1 : "bold,italic,|,link,unlink,|,formatselect,|,media,code",
            theme_advanced_buttons2 : "",
            theme_advanced_buttons3 : "",
            theme_advanced_buttons4 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "bottom",
            theme_advanced_resizing : true,
            theme_advanced_blockformats : "p,h3,h5",
            content_css : "/css/contenu.css",
            valid_elements : "*[*]"

I've tried with "media_strict:true|false", with "cleanup:false|true", with "extend_valid_elements" and many other tricks, with no results!?

This trouble is the same with FF 3.5.2 or Safari 4.0.3 on MacOS 10.5.8

2

Re: Media plugin trouble when save YouTube url

I think removing the object tag might be the issue here. The param tag isn't a valid element on its own. Test if this has anything to do with it.

3

Re: Media plugin trouble when save YouTube url

I'm sorry, but I don't understand your answer?! Maybe it's because I'm French smile

I don't remove nothing by myself... Like you can see in my first code sample, the <object> is present! But after my form validation and before database saving, TinyMCE remove it and just keep the <param> tag, which is stored in the table. It's not me!

4

Re: Media plugin trouble when save YouTube url

My mistake, I read it as you filtered out the object tag on your own. Try removing your valid_elements declaration, not sure if that's the issue in your init. If you post your wanted code in the example on this site you see that it works the way it should, so it's either your init (and I'm guessing on valid_elements) or it's something server sided.

5

Re: Media plugin trouble when save YouTube url

Ok, I've removed valid_elements and it doesn't work...

I'm using PHP 5.2 and MySQL 5.

I've made a "var_dump" in the function that handle the $_POST data and the <object> tag removing is done before the POST!
So I don't think it is a server-side issue but really TinyMCE behavior...

But I'm using the Jquery instance to launch TinyMCE:

<script type="text/javascript" src="js/tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript">
    //<![CDATA[
    $(function() {
        $('.tinymce').tinymce({
            // Location of TinyMCE script
            script_url : 'js/tiny_mce/tiny_mce.js',


            // General options
            theme : "advanced",
            plugins : "safari,style,layer,save,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",


            // Theme options
            theme_advanced_buttons1 : "bold,italic,|,link,unlink,|,formatselect,|,media,code",
            theme_advanced_buttons2 : "",
            theme_advanced_buttons3 : "",
            theme_advanced_buttons4 : "",
            theme_advanced_toolbar_location : "top",
            theme_advanced_toolbar_align : "left",
            theme_advanced_statusbar_location : "bottom",
            theme_advanced_resizing : true,
            theme_advanced_blockformats : "p,h3,h5",
            content_css : "/css/contenu.css"
        });
    });
    //]]>
</script>

Last edited by avairet (2009-08-21 15:17:49)

6

Re: Media plugin trouble when save YouTube url

When you click the HTML button you say the code looks ok right? This is the same cleanup that happens when you submit (not sure how you're doing it), but this means the cleanup in Tiny isn't removing the object. So you must be doing something to the code that you aren't showing, maybe something in --> "7- valid my form to save text in my database"?

7

Re: Media plugin trouble when save YouTube url

Ok, thanks for your replies Chrazy...
But I'm sure there is no "callback" in my form validation, that would remove something of the textarea handled by TinyMCE!

When I click on my form submit (simple HTML submit), I see TinyMCE works on the code and remove the <object> tags: it's appears before my validation page is loaded...