asp.net - 如何允许在 TinyMCE 中嵌入内联标签

我的页面(asp.net 页面)上有 TinyMCE 控件。我正在尝试编辑 html 并插入嵌入标签,但是一旦我切换到 WYSIWYG 模式,然后回到 html 编辑模式,我可以看到嵌入标签被清除,并添加为新的 PARAM 内联标签对象标记。这是示例 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>

所以this变成了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>

您可能已经注意到,embed 标签的属性变成了 object 标签的 param 内联标签。 我在网上搜索了一下,主要的解决办法是添加媒体插件,将media_strict设置为false,但没有用,所以我继续搜索,遇到了另一个建议——使用extended_valid_elements,但目前还没有。这是我的 TinyMCE 控件的初始化函数

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

我做错了什么?我怎样才能使这项工作? 我正在使用 TinyMCE v.3.9.2

最佳答案

于是问题就变得荒谬了。 media_strict 和 convert_urls 接受 bool 值而不是字符串,所以我只需要将 bool 值而不是字符串传递给这些参数,它就像一个魅力。

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

https://stackoverflow.com/questions/12969616/

相关文章:

maven - 从 Java 类路径加载 JRuby 脚本

c# - PDFSharp 使用 PdfTextField 作为位置和大小引用在 pdf 中插入图像

php - DOMDocument::save[domdocument.save]:无法打开流:权限

hibernate - 带有关联表的 JPA 注解

nginx - 在 nginx 托管上出现 502 错误网关错误

python - 故意在python中制作一个孤儿进程

heroku - 如何在 Heroku bash 或 Heroku Scheduler 中实现 He

python - Python 中的伪随机二进制序列 (prbs)

python - 是否可以在 Pandas 中将 searchsorted 与 MultiIndex

Django 模型 - 共享公共(public)基类的不同对象类型的外键