How to allow some custom tag in tinymce editor

2019-08-15 02:04发布

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

2条回答
Evening l夕情丶
2楼-- · 2019-08-15 02:40

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

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

查看更多
Ridiculous、
3楼-- · 2019-08-15 02:57

Use .html() in jquery

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

FIDDLE

查看更多
登录 后发表回答