当前位置: 移动技术网 > IT编程>开发语言>JavaScript > CKEditor无法读取config.js配置的问题

CKEditor无法读取config.js配置的问题

2020年07月12日  | 移动技术网IT编程  | 我要评论

问题描述

CKEditor中配置文件config.js不生效

解决办法

在初始化的时候,指定config.js的位置,你也可以重新自定义一个,指定你要使用的配置文件路径即可

<textarea id="ceditor" placeholder="your comment here"></textarea>
<script>
    CKEDITOR.replace( 'ceditor',{
        customConfig: '/static/ckeditor/config.js',
    });
</script>

config.js

/**
 * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
 */

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here. For example:
	// config.language = 'fr';
	// config.uiColor = '#AADC6E';
	config.language = 'en';
	config.toolbar = 'Full';
	// config.keystrokes = [
	// 	[CKEDITOR.CTRL + 86 /* V */, 'paste']
	// ];
};

 效果图

注意,这里textarea就不能加class="ckeditor"了,否则会报错

[CKEDITOR] Error code: editor-element-conflict. 

本文地址:https://blog.csdn.net/ssjdoudou/article/details/107276409

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网