Utf 8 CKeditor-4,如何禁用字体符号?

Utf 8 CKeditor-4,如何禁用字体符号?,utf-8,ckeditor,Utf 8,Ckeditor,My(现在使用的是CKEditor v4.2.2)不支持,因此在线编辑工具必须保持在线版本UTF-8的“纯度” 当用户从外部文本复制/粘贴到编辑框时,会出现问题 <p><font face="Symbol">&bull; </font>blabla <font face="Symbol">S</font> blabla;</p> 首先,如果您想解决这个问题,您需要找到这些字符的字典,它将允许您将原始字符

My(现在使用的是CKEditor v4.2.2)不支持
,因此在线编辑工具必须保持在线版本UTF-8的“纯度”

当用户从外部文本复制/粘贴到编辑框时,会出现问题

 <p><font face="Symbol">&bull; </font>blabla 
    <font face="Symbol">S</font> blabla;</p>

首先,如果您想解决这个问题,您需要找到这些字符的字典,它将允许您将原始字符转换为UTF-8表示形式

要将此转换应用于所有
font
元素,请使用。将应用于加载或插入编辑器的所有数据

editor.dataProcessor.dataFilter.addRules( {
    elements: {
        font: function( el ) {
            // el will be an instance of CKEDITOR.htmlParser.element
            // el.children[ 0 ] will be an instance of CKEDITOR.htmlParser.text
            // You'll need to read a value of that text, replace
            // all characters with their UTF-8 representatives
            // and return:
            return new CKEDITOR.htmlParser.text( text );
            // That will replace font tags with returned text nodes.
        }
    }
} );

在这里,您可以找到更复杂的数据处理器使用示例:

谢谢@Reinmar,您是CKeditor人员,所以我相信您的答案是正确的!这个但是我需要更多的帮助来复制/粘贴代码(使用
返回新的CKEDITOR.htmlParser.text('HelloWorld');
)到CKedtitor实现中,请参阅问题文本中我编辑的附录-不工作,我需要复制/粘贴代码的地方?最佳位置将在
编辑器#pluginsload
侦听器中。此时数据处理器实例将准备就绪。您也可以将其添加到
编辑器#instancerady
侦听器中,但这是在数据被过滤之后,因此您的过滤器将丢失启动时加载的数据。
  CKEDITOR.on( 'instanceCreated', function( event ) {  // contenteditable
      var editor = event.editor;
      // ...
      editor.on( 'configLoaded', function() {
           editor.config.skin           = '...';
           // ...
      });
  });
editor.dataProcessor.dataFilter.addRules( {
    elements: {
        font: function( el ) {
            // el will be an instance of CKEDITOR.htmlParser.element
            // el.children[ 0 ] will be an instance of CKEDITOR.htmlParser.text
            // You'll need to read a value of that text, replace
            // all characters with their UTF-8 representatives
            // and return:
            return new CKEDITOR.htmlParser.text( text );
            // That will replace font tags with returned text nodes.
        }
    }
} );