2017-06-22 52 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