如何防止CKEditor用& nbsp ;?替换空格? [英] How to prevent CKEditor replacing spaces with  ?
问题描述
我遇到了 CKEditor 4 的问题,我需要一个没有任何html实体的输出,因此我添加了 config.entities = false;
,但在
I'm facing an issue with CKEditor 4, I need to have an output without any html entity so I added config.entities = false;
in my config, but some
appear when
- 插入内嵌标记:
& nbsp;
- text粘贴:即使使用
config.forcePasteAsPlainText = true;
,每个空格都替换为& li>
- an inline tag is inserted: the space before is replaced with
- text is pasted: every space is replaced with
even withconfig.forcePasteAsPlainText = true;
您可以在任何演示上输入
测试
$ b b
例如
eg.
你知道我如何防止这种行为?
Do you know how I can prevent this behaviour?
谢谢! p>
Thanks!
推荐答案
这些实体:
// Base HTML entities.
var htmlbase = 'nbsp,gt,lt,amp';
是一个例外。要摆脱它们,你可以设置 basicEntities:false
。但是,由于文档提到这是一个不安全的设置。所以如果你只想删除& nbsp;
,那么我应该使用regexp对输出数据(例如通过添加侦听器 htmlFilter code>就像实体
插件在这里。
Are an exception. To get rid of them you can set basicEntities: false
. But as docs mention this is an insecure setting. So if you only want to remove
, then I should just use regexp on output data (e.g. by adding listener for #getData) or, if you want to be more precise, add your own rule to htmlFilter
just like entities
plugin does here.
这篇关于如何防止CKEditor用& nbsp ;?替换空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!