2016-12-09 70 views
1

這裏是插件的配置。TinyMCE不允許將div塊放入標記

theme: "modern", 
    toolbar: "link, image, styleselect, formatselect forecolor backcolor | bold,italic,underline | bullist,numlist,outdent,indent | undo,redo | pastetext,pasteword,selectall | code fullscreen", 
    pagebreak_separator: "<p class='page-separator'>&nbsp;</p>", 
    plugins: 'link image code fullscreen wordcount textcolor', 
    relative_urls: false, 
    remove_script_host: false, 
    image_caption: true, 
    cleanup_on_startup: false, 
    trim_span_elements: false, 
    verify_html: false, 
    cleanup: false, 
    convert_urls: false, 
    valid_elements: '*[*]', 
    valid_children: '*[*]', 
    allow_html_in_named_anchor: true, 
    allow_unsafe_link_target: true, 
    force_br_newlines: false, 
    force_p_newlines: false, 
    forced_root_block: '', 
    document_base_url: (!window.location.origin ? window.location.protocol + "//" + window.location.host : window.location.origin) + "/" 

所以,我想要做的就是把背景圖像的div塊放入標籤。你可以看到,我實現了一些選項來禁止源代碼的驗證,但是tinymce仍然在編輯我的代碼。什麼,我需要 例子:

<a href="http://mosplitka.ru/uploads/Cersaie/cersaie_17.jpg" data-gallery="cersaie"> 
 
    <div class="page-gallery-item-bg" style="background-image:url('http://mosplitka.ru/uploads/Cersaie/medium_cersaie_17.jpg'); ">   
 
    &nbsp;</div>&nbsp; 
 
</a>
到底是什麼我關閉源代碼面板後得到:

<div class="page-gallery-item-bg" style="background-image: url('http://mosplitka.ru/uploads/Cersaie/medium_cersaie_17.jpg');">&nbsp;</div> 
 
<a href="http://mosplitka.ru/uploads/Cersaie/cersaie_17.jpg" data-gallery="cersaie">&nbsp; </a>

回答

1

我想我找到了。 我確定參數valid_children:'[]'包括標籤的所有變體,但顯然不是。所以我將它改爲valid_children:'a [div]',結果如此。仍然無法弄清爲什麼第一個版本沒有解決。希望能幫助別人。