简体   繁体   English

如何将 CKEditor 上的主题/皮肤从浅色更改为深色?

[英]How to change theme/skin on CKEditor from light to dark?

I'm using CKEditor for my site, I'm trying to turn all elements from light to become a dark mode.我正在为我的网站使用 CKEditor,我试图将所有元素从光变成暗模式。

在此处输入图像描述


I have我有

<script src="//cdn.ckeditor.com/4.8.0/standard/ckeditor.js"></script>



<textarea name="description" rows="100" cols="80" id="description">
......TEXTS......
</textarea>
<script>
CKEDITOR.replace( 'description' );
CKEDITOR.config.height = 500;
</script>

I've tried我试过了

Download the zip, and move it into my project at /js .下载 zip,并将其移至我的/js项目中。

CKEDITOR.replace( 'description', {
    skin: 'moonocolor,/js/ckeditor/skins/moono-dark/skin.js',
    height : 500
} );

This line这条线

skin: 'moonocolor,/js/ckeditor/skins/moono-dark/skin.js',皮肤:'moonocolor,/js/ckeditor/skins/moono-dark/skin.js',

doesn't seem to work.似乎不起作用。

Go to https://ckeditor.com/cke4/builder Choose Standard preset, then choose the skin Moono Dark, then click Download button at the end. Go 到https://ckeditor.com/cke4/builder选择标准预设,然后选择皮肤 Moono Dark,然后单击最后的下载按钮。 Unzip the file in /js/ folder and just use:/js/文件夹中解压缩文件,然后使用:

<script src="/js/ckeditor/ckeditor.js"></script>
<textarea name="description" rows="100" cols="80" id="description">
</textarea>
<script>
CKEDITOR.replace( 'description' );
</script>

No need to use skin config option since Moono Dark is the only skin in your setup.无需使用skin配置选项,因为 Moono Dark 是您设置中唯一的皮肤。

EDIT: If you want black background with white text, add this line before the replace command:编辑:如果您想要带有白色文本的黑色背景,请在replace命令之前添加此行:

CKEDITOR.addCss('.cke_editable { background-color: black; color: white }');

or edit contents.css in ckeditor directory and change CSS of body tag (but this file is replaced if you update ckeditor, so be careful) or edit contents.css 8CBA22E28EB17B5F5C6AE2A266AZ in ckeditor directory and change CSS of body tag (but this file is replaced if you update ckeditor, so be careful)

or create a new file myfile.css in ckeditor directory with your CSS modifications of body tag or .cke_editable class and load it in your config file with: or create a new file myfile.css in ckeditor directory with your CSS modifications of body tag or .cke_editable class and load it in your config file with:

config.contentsCss = [CKEDITOR.getUrl('contents.css'), CKEDITOR.getUrl('myfile.css')];

EDIT2: To change the border color you have to modify your web page CSS, not ckeditor, like this: EDIT2:要更改边框颜色,您必须修改 web 页面 CSS,而不是 ckeditor,如下所示:

.cke_chrome {
    border: 1px solid black !important;
}

For the bottom bar, I only know how to completely remove it, but you can't resize ckeditor after you do that.对于底栏,我只知道如何完全删除它,但是你这样做后不能调整 ckeditor 的大小。 Add these lines to your config file:将这些行添加到您的配置文件中:

config.removePlugins = 'elementspath';
config.resize_enabled = false;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM