2013-03-22 27 views
1

我可以設置background-color爲藍色:如何配置默認的文字顏色的CKEditor

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

如何更改默認的顏色爲白色的CKEditor?

回答

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> 
+0

謝謝。輸入的單詞看起來'白色'。但我存儲他們,我發現它是死的黑色。我稍後會在其他地方展示他們。 – Ron 2013-03-22 09:22:24

+1

我編輯了一個答案,希望現在更清楚。 – Nenotlep 2013-03-22 10:26:53

+0

編輯content.css是如果你問我這種改變的最好方法。 – spons 2013-03-22 11:43:04

相關問題