开发者

TinyMCE removes youtube links

开发者 https://www.devze.com 2023-02-22 20:27 出处:网络
I\'ve got a symfony form with a \"contents\" textarea, which uses tinyMCE. When I write : <p class=\"centre\">

I've got a symfony form with a "contents" textarea, which uses tinyMCE.

When I write :

<p class="centre">
<object width="640" height="385">
<param name="movie" value="http://www.youtube.com/v/qOP2V_np2c0&hl=en_US&fs=1&rel=0">
</param>
<param name="allowFullScreen" value="true">
</param>
<param name="allowscriptaccess" value="always">
</param>
<embed src="http://www.youtube开发者_如何学编程.com/v/qOP2V_np2c0&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385">
</embed>
</object>
</p>

It gets saved as :

<p class="centre">
<object width="640" height="385">
<param name="movie" value="http://www.youtube.com/v/qOP2V_np2c0&amp;hl=en_US&amp;fs=1&amp;rel=0" />
<param name="allowFullScreen" value="true" />
<param name="allowscriptaccess" value="always" />
</object>
</p>


I had to add some elements to *extended_valid_elements* so that it wouldn't remove flash content.

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]“
});

Answer found on http://syedgakbar.wordpress.com/2008/01/28/adding-flash-embed-support-in-tinymce-editor/


Just add the param tag inside the closed key of your init config array:

tinyMCE.init({
    ...
    closed: /^(br|hr|input|meta|img|link|param|area|param)$/,
    ...
});

Source

0

精彩评论

暂无评论...
验证码 换一张
取 消