简体   繁体   English

如何在tinymce编辑器中允许一些自定义标签

[英]How to allow some custom tag in tinymce editor

when i pest a html code inside tinymce editor my < figure> tag remove by this editor. 当我在tinymce编辑器中获取html代码时,我的<Figure>标记将被该编辑器删除。

how to allow this tag in tinymce editor. 如何在tinymce编辑器中允许此标签。

<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 只需删除此<figure>1</figure>标记

Use .html() in jquery 在jquery中使用.html()

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

FIDDLE 小提琴

You need to tell TinyMCE to treat figure as valid element. 您需要告诉TinyMCE将figure视为有效元素。

Use this option: http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements 使用此选项: http : //www.tinymce.com/wiki.php/Configuration : extended_valid_elements

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM