Ron
Ron

Reputation: 563

how to config text default color in ckeditor

I can set the background-color to blue:

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

How do I change the default color to white in ckeditor?

Upvotes: 1

Views: 3815

Answers (1)

Joel Peltonen
Joel Peltonen

Reputation: 13412

Well, using that method it would simply be

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

However, there is a content stylesheet you can also change. It is usually located in your CKEditor installation folder, something like /ckeditor/contents.css.

Both of these edit the editor contents only within the editor, the styles don't apply after saving when the editor contents is shown elsewhere. To style the contents there, you need to either parse the CSS manually to be included with your own stylesheet or if the stylings are simple just do them inline. Your output code for the simple styles might look like this (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>

Upvotes: 4

Related Questions