Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/384.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ckeditor时间戳自定义插件示例不工作_Javascript_Plugins_Ckeditor - Fatal编程技术网

Javascript ckeditor时间戳自定义插件示例不工作

Javascript ckeditor时间戳自定义插件示例不工作,javascript,plugins,ckeditor,Javascript,Plugins,Ckeditor,我试图让ckeditor示例自定义插件工作,但到目前为止我什么都没有:没有控制台错误,但也没有插件 这就是我下面的例子: 由于我已经逐字复制了他们的代码,我怀疑问题更多地与下面的ckeditor配置有关 我的插件目录结构(从github复制的所有文件): $ tree public/javascripts/ckeditor/plugins/timestamp public/javascripts/ckeditor/plugins/timestamp ├── icons │   └── t

我试图让ckeditor示例自定义插件工作,但到目前为止我什么都没有:没有控制台错误,但也没有插件

这就是我下面的例子:

由于我已经逐字复制了他们的代码,我怀疑问题更多地与下面的ckeditor配置有关

我的插件目录结构(从github复制的所有文件):

$ tree public/javascripts/ckeditor/plugins/timestamp
public/javascripts/ckeditor/plugins/timestamp
├── icons
│   └── timestamp.png
├── plugin.js
└── samples
    └── timestamp.html
/**
 * @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;
};
My ckeditor public/javascripts/ckeditor/config.js:

$ tree public/javascripts/ckeditor/plugins/timestamp
public/javascripts/ckeditor/plugins/timestamp
├── icons
│   └── timestamp.png
├── plugin.js
└── samples
    └── timestamp.html
/**
 * @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;
};
这就是我所看到的一切。也没有javascript错误:/


插件创建一个工具栏按钮,放在“插入”工具栏组中:

editor.ui.addButton( 'Timestamp', {
    label: 'Insert Timestamp',
    command: 'insertTimestamp',
    toolbar: 'insert'
});
因为您的配置中没有这样的工具栏组,所以不会显示它