3
votes

I have TinyMCE control on my page ( asp.net page ). I'm trying to edit html and insert embed tags, but as soon as I switch to WYSIWYG mode, and then back to html edit mode, I can see that embed tags were cleared out, and added as a new PARAM inline tags for the OBJECT tag. Here's example html

<OBJECT id=ETFflash1016 codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=345 align=middle height=230>
<PARAM NAME="ProfileAddress" VALUE="">
<PARAM NAME="ProfilePort" VALUE="0">
<PARAM NAME="AllowNetworking" VALUE="all">
<PARAM NAME="AllowFullScreen" VALUE="false">
<PARAM NAME="AllowFullScreenInteractive" VALUE="false">
<PARAM NAME="IsDependent" VALUE="0">
<embed src="/video/ETFflash1016.swf.cms" quality="high" bgcolor="#ffffff" width="345" height="230" name="ETFflash1016" align="left" allowScriptAccess="sameDomain" allowFullScreen="false" wmode="Transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>
</OBJECT>

So this has been transformed to this

<object id="ETFflash1016" width="345" height="230" data="../../../video/ETFflash1016.swf.cms" type="application/x-shockwave-flash">
    <param name="Profile" value="0" />
<param name="ProfilePort" value="0" />
<param name="AllowNetworking" value="all" />
<param name="AllowFullScreen" value="false" />
<param name="AllowFullScreenInteractive" value="false" />
<param name="IsDependent" value="0" />
<param name="src" value="../../../video/ETFflash1016.swf.cms" />
<param name="name" value="ETFflash1016" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="Transparent" />
<param name="allowfullscreen" value="false" />
<param name="quality" value="high" />
</object>

As you may have noticed, embed tag's attributes became param inline tags for object tag. I've searched the web, and the main solution was to add media plugin, set media_strict to false, but it didn't help, so I continue to search, and came across another suggestion - use extended_valid_elements but no lack so far. Here's the init function of my TinyMCE control

tinyMCE.init({
            mode: "exact",
            theme: "advanced",
            plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,spellchecker,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist",
            media_strict: "false",
            convert_urls: "false",
            theme_advanced_resizing: true,");
            onchange_callback : "HandleTinyEditorChange",
            valid_elements : "*[*]\",
            extended_valid_elements : "object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode]"
            });

What I'm doing wrong ? How can I make this work ? I'm using TinyMCE v.3.9.2

1
+1 if possible keep your tinymce updated due to the fact that browsers advance fast and new browser versions may do havoc with rtesThariama

1 Answers

2
votes

So the problem turned to be ridiculous. media_strict and convert_urls accept booleans not strings, so I just had to pass boolean values to those params instead of strings, and it works like a charm.

tinyMCE.init({ 
            mode: "exact", 
            theme: "advanced", 
            plugins: "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,spellchecker,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist", 
            media_strict: false, 
            convert_urls: false, 
            theme_advanced_resizing: true,"); 
            onchange_callback : "HandleTinyEditorChange", 
            valid_elements : "*[*]\", 
            extended_valid_elements : "object[width|height|classid|codebase],param[name|value],embed[src|type|width|height|flashvars|wmode]" 
            });