如何修改CKEditor的内容css?即在编辑模式下如何定义其css?

在ckeditor文件夹下找到contents.css,如果是使用config.contentsCss设置加载指定的css文件,那就找到对应的css文件然后编辑样式。

比如说,希望在编辑模式下默认的<p>都是首行缩进的,那就可以在contents.css文件中加入:

p{
text-indent:2em;
}
Edit the contents.css file that's located in the main CKEditor directory or use the config.contentsCss setting to load a different file.

I see that you confused the styles system settings with content styling. These are two totally different things - styles system is responsible for applying and removing "styles" to selected content - it's used e.g. by styles and format drop downs as well as bold or italic buttons - all of them are "styles".

As for CKEDITOR.addCss() - this method is to be used by plugins mostly and it has to be used before editor is created. Actually, its doc says exactly this and mentions that you should use contents.css ;).

参考文档

  • http://stackoverflow.com/questions/25089112/how-can-i-change-the-ckeditor-iframe-css-styling

发表评论