简体   繁体   English

CKEDITOR不会设置来自数据库的文本的样式

[英]CKEDITOR doesn't style my text that comes from the DB

I'm inputting data into a rich textarea with CKEDITOR. 我正在使用CKEDITOR将数据输入到一个丰富的textarea中。 That data is being sent to the database. 该数据将被发送到数据库。 But when I do a SELECT to get the text back to output it, the applied styles aren't applied to it. 但是,当我执行SELECT使其返回文本以将其输出时,所应用的样式不会应用到该文本。

Example: In my CKEDITOR I input the text 'Well worked today' and I put the word worked in bold/strong. 示例:在我的CKEDITOR中,输入文本“今天工作得很好”,然后以粗体/强壮形式输入“工作正常”一词。 then it gets saved in my DB as 然后将其保存为我的数据库中

<p>Well<strong>worked</strong>today</p>

Then I do a SELECT to output that text to my screen. 然后我执行SELECT将该文本输出到我的屏幕。

But the the word isn't being bold But when looking in debug console it is marked as 但是这个词不是粗体,而是在调试控制台中被标记为

<p>Well<strong>worked</strong>today</p>

The same can be said if I'm trying to give it an other color. 如果我要给它其他颜色,也可以这样说。

How I output the text onto my screen: echo $row->text; 如何将文本输出到屏幕上: echo $row->text;

How I embed my CKEDITOR: 我如何嵌入我的CKEDITOR:

$text = array('name' => "text",'class' => "ckeditor");
echo form_textarea($text);

Why isn't it showing the applied styles? 为什么不显示所应用的样式?

If you removed some stylings form the toolbar and from the CK editor instance itself, the window will accept only styling tags allowed after "lightening" the editor. 如果从工具栏和CK编辑器实例本身中删除了某些样式,则该窗口将仅接受“减轻”编辑器后允许的样式标签。

For instance, if you make an instance of editor with only basic styles toolbar, heading styles would immediately be converted to standard text, ie p tags, but strong, italic and strikethrough would be rendered properly. 例如,如果您仅使用基本样式工具栏创建编辑器实例,则标题样式将立即转换为标准文本,即p标签,但将正确呈现强,斜体和删除线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM