2017-06-22 83 views
0

我試圖讓ckeditor示例自定義插件工作,但到目前爲止我什麼都沒有:沒有控制檯錯誤,但沒有插件。ckeditor timestamp自定義插件示例不工作

這是我繼例如:

自從我逐字複製他們的代碼,我嫌疑問題與更合我的下面的ckeditor配置。

我的插件目錄結構(從GitHub複製所有文件):

$ tree public/javascripts/ckeditor/plugins/timestamp 
public/javascripts/ckeditor/plugins/timestamp 
├── icons 
│   └── timestamp.png 
├── plugin.js 
└── samples 
    └── timestamp.html 

我CKEditor的公共/ Java腳本/ CKEditor的/ config.js:

/** 
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. 
* For licensing, see LICENSE.md or http://ckeditor.com/license 
*/ 

CKEDITOR.editorConfig = function(config) { 
    // Define changes to default configuration here. 
    // For complete reference see: 
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config 

    // The toolbar groups arrangement, optimized for two toolbar rows. 
    config.toolbarGroups = [ 
     { name: 'styles', groups: [ 'styles' ] }, 
     { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] }, 
     { name: 'editing',  groups: [ 'find', 'selection', 'spellchecker' ] }, 
     { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, 
     { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, 
     { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, 
     { name: 'others' }, 
     { name: 'forms' }, 
     { name: 'tools' } 
    ]; 

    // Remove some buttons provided by the standard plugins, which are 
    // not needed in the Standard(s) toolbar. 
    config.removeButtons = 'Underline,Styles,Strike,Image,Outdent,Indent,Blockquote,Cut,Copy,Paste,PasteFromWord,Undo,Redo'; 

    // Set the most common block elements. 
    config.format_tags = 'p;h1;h2;h3;h4'; 

    // Simplify the dialog windows. 
    config.removeDialogTabs = 'image:advanced;link:advanced'; 

    // Whether to escape basic HTML entities in the document, including: 
    // (nbsp,gt,lt,amp) 
    config.basicEntities = false; 
    config.entities_additional = 'lt,gt,amp,quot' 
    config.entities_latin = false; 
    config.entities_greek = false; 
    config.disableNativeSpellChecker = false; 
    config.removePlugins = 'wsc,scayt'; 
    config.extraPlugins = 'timestamp'; 
    config.scayt_autoStartup = false; 
    config.height = 1000; 
}; 

這是所有我懂了。被投入/

enter image description here

回答

1

插件創建了一個工具欄按鈕「插入」工具欄組:沒有JavaScript錯誤或者

editor.ui.addButton('Timestamp', { 
    label: 'Insert Timestamp', 
    command: 'insertTimestamp', 
    toolbar: 'insert' 
}); 

既然你沒有這樣一個工具欄組你的配置,它不會被顯示。

+0

完全是這樣 - 謝謝@Wizard! – doub1ejack