如何在ckeditor中配置文本默认颜色

时间:2013-03-22 01:38:24

标签: ckeditor

我可以将background-color设置为蓝色:

eventHandler.addEventHandler('instanceReady', function(e) {
    e.editor.document.getBody().setStyle('background-color', 'blue');
});

如何在ckeditor中将默认颜色更改为白色?

1 个答案:

答案 0 :(得分:4)

好吧,使用那种方法就可以了

e.editor.document.getBody().setStyle('color', 'white');

但是,您还可以更改内容样式表。它通常位于您的CKEditor安装文件夹中,类似于/ckeditor/contents.css

这两个都只在编辑器中编辑编辑器内容,当编辑器内容显示在别处时保存后样式不适用。要在那里设置内容的样式,您需要手动解析CSS以包含在您自己的样式表中,或者如果样式很简单,只需将它们内联。简单样式的输出代码可能如下所示(JSP)。

<div id="CKEditorOutput" style="color:white; background-color:blue;">
<%!
    String ckeOutput() {
        // Here output your saved contents from where ever you saved them
        return "<p>Your CKEditor contents</p>";
    }
%>
<% ckeOutput(); %>
</div>
相关问题