gpt4 book ai didi

javascript - ckeditor 时间戳自定义插件示例不起作用

转载 作者:行者123 更新时间:2023-12-03 04:01:12 25 4
gpt4 key购买 nike

我正在尝试让 ckeditor 示例自定义插件正常工作,但到目前为止我一无所获:没有控制台错误,但也没有插件。

这是我正在遵循的示例:

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

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

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

我的ckeditor public/javascripts/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;
};

这就是我所看到的。也没有 JavaScript 错误:/

enter image description here

最佳答案

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

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

由于您的配置中没有这样的工具栏组,因此不会显示它。

关于javascript - ckeditor 时间戳自定义插件示例不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44709100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com