2012-10-19 87 views
2

我的頁面(asp.net頁面)上有TinyMCE控件。我試圖編輯HTML和插入嵌入標籤,但只要我切換到所見即所得模式,然後回到HTML編輯模式,我可以看到嵌入標籤被清除,並添加爲一個新的PARAM內聯標籤爲OBJECT標籤。這裏的例子HTML如何允許在TinyMCE中嵌入嵌入式標籤

<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> 

正如你可能已經注意到,嵌入標籤的屬性成爲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

+0

+1如果可能,請繼續更新tinymce,因爲瀏覽器前進速度快,新瀏覽器版本可能會對rtes造成嚴重破壞 – Thariama

回答

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