How to allow some custom tag in tinymce editor

谁说胖子不能爱 提交于 2019-12-11 12:07:35

问题


when i pest a html code inside tinymce editor my < figure> tag remove by this editor.

how to allow this tag in tinymce editor.

<ul>
<li>
    <div class="list-top">
        <figure>1</figure>
        <div class="list-top-right">
            <h3>It's Competitive Out There</h3>
        </div>
    </div>      
</li>
</ul>

it convert into

<ul>
<li>
    <div class="list-top">
        1
        <div class="list-top-right">
            <h3>It's Competitive Out There</h3>
        </div>
    </div>      
</li>
</ul>

Just remove this <figure>1</figure> tag


回答1:


Use .html() in jquery

$("ul li").html(function(i,h){ 
         return h.replace(/<figure>/g,'').replace(/<\/figure>/g,'');
}); 

FIDDLE




回答2:


You need to tell TinyMCE to treat figure as valid element.

Use this option: http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements



来源:https://stackoverflow.com/questions/27225638/how-to-allow-some-custom-tag-in-tinymce-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!