我有一个深色背景,所以我为 ClassicEditor 应用了颜色,这是屏幕截图。
它工作正常,直到我将编辑器焦点移出它再次变白,这是编辑器焦点移出后的屏幕截图。
这是我的代码:
ClassicEditor
.create($("#desc")[0], {
language: $("html").attr("lang"),
alignment: {
options: ['left', 'right']
},
autoParagraph : false
})
.then(editor => {
myEditor = editor;
myEditor.model.document.on('change', (event) => {
$("#desc").val(myEditor.getData());
});
$(".ck-content").css("background-color", "rgb(32,41,64)");
$(".ck-content p").css("color", "white");
$(".ck-toolbar").css("background-color", "rgb(32,41,64)");
$(".ck-button__label, .ck-icon").css("color", "white");
myEditor.editing.view.document.on('change:isFocused', ( evt, data, isFocused ) => {
if (isFocused) // blur
{
$(".ck-content").css("background-color", "rgb(32,41,64)");
}else{
$(".ck-content p").css("cssText", "background-color: rgb(32,41,64) !important; margin: 0px !important; padding: 3px 6px;");
//this one not working
$(".ck-editor__editable").css("cssText", "background-color: rgb(32,41,64) !important; padding : 0px;");
}
});
console.log(myEditor);
})
.catch(error => {
console.error(error);
});