CKEditor过度格式化纯文本 [英] CKEditor excessive formatting of plain text
问题描述
问题:
CKEditor添加了大量的< span>
>设置是一个php页面,调用ckeditor并将条目保存到PostgreSQL表中。我认为CKEditor上的大多数设置是默认的。下面是一些代码:
include('./ckeditor/ckeditor.php');
$ CKEditor = new CKEditor();
$ CKEditor-> returnOutput = true;
$ CKEditor-> basePath ='/ ckeditor /';
$ CKEditor-> config ['width'] = 560;
$ CKEditor-> config ['height'] = 300;
$ CKEditor-> textareaAttributes =
array(cols=> 90,rows=> 70);
$ CKEditor-> config ['DefaultLanguage'] =sv;
// $ CKEditor-> config ['EnterMode'] = CKEDITOR.ENTER_BR;
$ config ['toolbar'] = array(
array('Source',' - ','Bold','Italic','Underline','Strike',' - '),
array('Image','Link','Unlink',' - ','Table','NumberedList','BulletedList')
);
$ config ['skin'] ='v2';
输入/输出示例(源代码):
输入:
En hel del av $
成为:
span data-scayt_word =heldata-scaytid =2> hel< / span> del
< span data-scayt_word =avdata-scaytid =3> av< / span>
< span data-scayt_word =erdata-scaytid =4> er< / span>有没有办法避免这种行为?
$ b < h2_lin>解决方案
最简单的方法:禁用拼写检查(scayt - 在输入时拼写检查)
$ CKEditor-> config ['removePlugins'] ='scayt'; //逗号分隔if many
如果您想要离开SCAYT,自动开启:
$ CKEditor-> config ['scayt_autoStartup'] = false;
但这是奇怪的行为,如何从ckeditor实例检索内容?只是尝试从firebug获取数据,以查看不脏的内容:
console.log(CKEDITOR.instances.your_instance_name.getData ));
The problem:
CKEditor is adding tons of <span>
tags to plain text, such as the example below.
The code:
The setup is a php page, calling ckeditor and saving entries into a PostgreSQL table. I believe most settings on CKEditor is default. Here's some of the code:
include ('./ckeditor/ckeditor.php') ;
$CKEditor = new CKEditor() ;
$CKEditor->returnOutput = true;
$CKEditor->basePath = '/ckeditor/';
$CKEditor->config['width'] = 560;
$CKEditor->config['height'] = 300;
$CKEditor->textareaAttributes =
array("cols" => 90, "rows" => 70);
$CKEditor->config['DefaultLanguage'] = "sv" ;
//$CKEditor->config['EnterMode'] = CKEDITOR.ENTER_BR;
$config['toolbar'] = array(
array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike', '-' ),
array( 'Image', 'Link', 'Unlink', '-', 'Table', 'NumberedList','BulletedList' )
);
$config['skin'] = 'v2';
Example input/output (in source):
The input:
En hel del av er
Becomes:
En <span data-scayt_word="hel" data-scaytid="2">hel</span> del
<span data-scayt_word="av" data-scaytid="3">av</span>
<span data-scayt_word="er" data-scaytid="4">er</span>
Is there a way to avoid this behaviour?
The easiest way: disable the spellchecker (scayt - spellcheck as you type)
$CKEditor->config['removePlugins'] ='scayt'; // comma separated if many
If you want to leave SCAYT available, but prevent the feature from being turned on automatically:
$CKEditor->config['scayt_autoStartup'] = false;
But this is strange behavior, how do you retrieves the content from ckeditor instance? Just try to get data from firebug to see the not dirty content:
console.log( CKEDITOR.instances.your_instance_name.getData() );
这篇关于CKEditor过度格式化纯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!