2012-07-05 99 views
2

我試圖在TinyMCE包裹的文本字段中插入一個簡單的圖像鏈接,但它剝離出所有我的標記。我的標記看起來像:TinyMCE剝離所有標記

<a class="video-launcher lightbox-video-launcher" href="http://www.youtube.com/watch?v=blah" ><span class="video-launcher-bg"></span><span class="video-launcher-button"></span></a> 

我tinymce_config_url_init.html樣子:

{ 
    "theme_advanced_toolbar_align":"left", 
    "content_css":"/media/css/cms_tinymce.css,/media/css/cms_tinymce_admin.css", 
    "theme_advanced_blockformats":"p,h2,h3,div,customformat", 
    "theme_advanced_statusbar_location":"bottom", 
    "theme_advanced_path":false, 
    "plugins":"fullscreen,paste", 
    "valid_elements":"*[*]", 
    "media_strict":false, 
    "paste_auto_cleanup_on_paste":true, 
    "theme_advanced_styles":"Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1", 
    "width":"680", 
    "theme":"advanced", 
    "theme_advanced_font_sizes":"8px,10px,12px,14px,16px,18px,20px,24px,36px", 
    "theme_advanced_resizing":true, 
    "height":"300", 
    "relative_urls":false, 
    "theme_advanced_toolbar_location":"top", 
    "inline_styles":true, 
    "language":"en", 
    "theme_advanced_buttons1":"fullscreen,|,undo,redo,|,bullist,numlist,|,anchor,link,unlink,charmap,|,code,|,justifyleft,justifycenter,justifyright,|,image,", 
    "theme_advanced_buttons3":"", 
    "theme_advanced_buttons2":"removeformat,styleselect,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,|,forecolor,backcolor", 
    "removeformat_selector":"span,div,p,h1,h2,h3" 
} 

我知道這個問題是與TinyMCE的,因爲沒有提交表單,並只需再次點擊「HTML」按鈕, TinyMCE的彈出窗口顯示沒有內容。

我假設TinyMCE正在剝離它認爲看起來不安全或無效的東西。對於我的應用程序,它被用於管理部分,因此內容可以被信任。如何禁用TinyMCE配置導致此標記被剝離?

回答

0

將您的網站的CSS樣式表添加到"content_css"變量,也許?

而且還設置"paste_auto_cleanup_on_paste"爲false,不正確。

+0

不,這沒有效果。 – Cerin 2012-07-05 16:45:45

0

您應該仔細看看tinymce配置參數valid_elements.您需要將它們設置爲符合您的需求並定義有效的元素和屬性。

+0

我使用'valid_elements':「+ * [*]」,但我想Django- *刪除想要的HTML代碼。想法? – Daviddd 2013-02-08 10:37:18

+0

此設置不起作用,因爲一個錯誤 – Thariama 2013-02-08 10:42:11