[英]How to set data fetched from database in Ckeditor?
I use CKEditor to insert some content in 'wysiwyg' mode. 我使用CKEditor在“所见即所得”模式下插入一些内容。 I input "Hello World!"
我输入“ Hello World!” in the editor, and the real context inserted into database is
在编辑器中,插入数据库的实际上下文是
"<p>Hello World!</p>".
Now I load the data from database and set it into CKEditor: 现在,我从数据库加载数据并将其设置到CKEditor中:
String content = loadFromDb();
// --> <p>Hello, world!</p>
CKEditor.instances['test'].setData(content);
But in the CKEditor, it shows: 但是在CKEditor中,它显示:
<p>Hello, world!</p>
in 'wysiwyg' mode. 在“所见即所得”模式下。 When I click 'source' button, it shows:
当我单击“源”按钮时,它显示:
<p> <p&rt;Hello, world!</p></p>
How can I set the data as html code, and I can see only "Hello, world!" 如何将数据设置为html代码,并且只能看到“ Hello,world!” in CKEditor on 'wysiwyg' mode?
在“所见即所得”模式下的CKEditor中?
Do I need to use some type of Html encoder? 我需要使用某种类型的HTML编码器吗?
PS: I have reposted this question because no one answered it in 2012 and it was very important for me to get the answer for this. PS:我重新发布了这个问题,因为在2012年没有人回答这个问题,因此获得答案非常重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.