1

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

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

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

4

1 回答 1

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>
于 2013-03-22T07:21:10.140 回答