我的在线CMS (现在使用的是CKEditor v4.2.2)不支持<font face="Symbol">,所以在线编辑工具必须保持在线版本UTF-8的“纯度”。
当用户将外部文本复制/粘贴到CKeditor框时,会出现问题,
<p><font face="Symbol">• </font>blabla
<font face="Symbol">S</font> blabla;</p><font face="Symbol"> CKEditor可以将这些转换成“免费的UTF-8”,也就是说,CKEditor能保存吗?
<p>• blabla Σ blabla;</p>有一些配置只强制执行UTF8字符,而不使用字体符号?
编辑:用于测试上下文化的配置,
CKEDITOR.on( 'instanceCreated', function( event ) { // contenteditable
var editor = event.editor;
// ...
editor.on( 'configLoaded', function() {
editor.config.skin = '...';
// ...
});
});发布于 2013-10-26 13:55:59
首先,如果您想解决这个问题,您需要找到这些字符的字典,它将允许您将原始字符翻译成它们的UTF-8表示形式。
要将此转换应用于所有font元素,请使用dataProcessor。dataFilter应用于加载或插入编辑器的所有数据。
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.
}
}
} );在这里,您可以找到更复杂的dataProcessor用法示例:http://ckeditor.com/forums/CKEditor/Create-new-dom-elements-using-dataProcessor.htmlFilter
https://stackoverflow.com/questions/19575759
复制相似问题