我从其CDN加载CKEditor,然后使用其他文件更改默认配置:
<script type="text/javascript" src="//cdn.ckeditor.com/4.3.3/standard/ckeditor.js"></script>
<script type="text/javascript" src="/js/ckeditor/config.js"></script>
我的配置文件如下所示:
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for a single toolbar row.
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'forms' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' },
{ name: 'others' },
{ name: 'about' }
];
// The default plugins included in the basic setup define some buttons that
// we don't want too have in a basic editor. We remove them here.
config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';
// Let's have it basic on dialogs as well.
config.removeDialogTabs = 'link:advanced';
};
实际上我从以前的开发人员那里继承了这个应用程序,我试图转移到CDN,而不必为每次安装手动下载文件。
我也尝试从功能中删除配置,然后直接访问它们:
CKEDITOR.config.removeDialogTabs = 'link:advanced';
..但那也没有用。
我在控制台中没有收到任何错误,当我console.log(CKEDITOR)
时,我可以看到对象在那里。有什么明显的我做错了吗?感谢
答案 0 :(得分:1)
加载CDN的CKEditor不知道您要为其提供自定义配置,而是使用自己的默认配置。您应该定义指向自定义配置文件的config.customConfig
配置选项,如CKEditor CDN站点上所述。