我的页面上有TinyMCE控件(asp.net页面)。我正在尝试编辑html并插入嵌入标签,但是当我切换到WYSIWYG模式,然后回到html编辑模式时,我可以看到嵌入式标签被清除,并作为新的PARAM内联标签添加到OBJECT标签。这是示例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>
所以这已经变成了这个
<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>
您可能已经注意到,嵌入标记的属性成为对象标记的参数内嵌标记。 我搜索过网页,主要的解决方案是添加媒体插件,将media_strict设置为false,但它没有帮助,所以我继续搜索,并遇到了另一个建议 - 使用extended_valid_elements但到目前为止还不缺。这是我的TinyMCE控件的init函数
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
答案 0 :(得分:1)
所以问题变得荒谬了。 media_strict和convert_urls接受布尔值而不是字符串,所以我只需要将布尔值传递给那些参数而不是字符串,它就像一个魅力。
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]"
});