TinyMCE从<span>和<i>元素中删除类

Per*_*ika 2 wysiwyg tinymce font-awesome glyphicons tinymce-4

在TinyMCE的代码(源代码)编辑器中,当我想用类添加一些spani元素时(例如,当我想添加Font Awesome图标时) - TinyMCE删除了类.例如,如果我想添加:

<span class="fa fa-university"></span>
Run Code Online (Sandbox Code Playgroud)

最后我会:

<span></span>
Run Code Online (Sandbox Code Playgroud)

此外,在源代码编辑器中我尝试添加<i class="fa fa-university"></i>但问题是相同的 - 类被TinyMCE(<i></i>)删除.

我正在使用TinyMCE v4.4.1,这些是我的设置:

tinymce.init({
    selector: '#body',
    height: 500,
    theme: 'modern',
    plugins: [
        'advlist autolink lists link image charmap preview hr anchor pagebreak',
        'searchreplace wordcount visualblocks visualchars code fullscreen',
        'insertdatetime media nonbreaking save table contextmenu directionality',
        'emoticons template paste textcolor colorpicker textpattern codesample fontawesome noneditable'
    ],
    toolbar1: 'insertfile undo redo | formatselect fontselect fontsizeselect fontawesome',
    toolbar2: 'bold italic underline strikethrough forecolor backcolor removeformat superscript subscript | alignleft aligncenter alignright alignjustify | outdent indent',
    toolbar3: 'code preview | link unlink anchor image media | codesample | bullist numlist table blockquote hr nonbreaking | charmap emoticons | visualchars visualblocks',
    image_advtab: true,
    relative_urls: false,
    extended_valid_elements: 'span',
    content_css: '/css/all.css' // this includes fontwawesome...
});
Run Code Online (Sandbox Code Playgroud)

Mic*_*min 9

尝试将以下内容添加到您的TinyMCE配置中:

valid_elements: "*[*]"
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我可以<span>毫无问题地添加你的参考.