2014-12-03 70 views
0

我加載CKEditor的從它的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,而不是必須手動下載每個安裝的文件。

我試圖消除CONFIGS出來的功能太強了,然後直接訪問它們像這樣:

CKEDITOR.config.removeDialogTabs = 'link:advanced'; 

..但也不能工作。

我在控制檯中沒有得到任何錯誤,當我做console.log(CKEDITOR)時,我可以看到對象在那裏。有什麼顯而易見的,我做錯了嗎?謝謝

回答

1

CDN加載的CKEditor不知道你想給它提供一個自定義配置,而是使用它自己的默認配置。您應該定義config.customConfig配置選項,指向您的自定義配置文件,如CKEditor CDN站點上所述。