2017-07-25 53 views
0

使用最新的CKEditor,我试图从文档中添加他们的示例插件“timestamp”。我从他们提供的链接下载了Github的所有代码,并将所有内容放在适当的位置。CKEditor:不会出现插件按钮

文档:http://docs.ckeditor.com/#!/guide/plugin_sdk_sample GitHub的链接:https://github.com/ckeditor/ckeditor-docs-samples/tree/master/tutorial-timestamp

ckeditor/plugins/timestamp/plugin.js 
ckeditor/plugins/timestamp/icons/timestamp.png 
ckeditor/plugins/timestamp/samples/timestamp.html 

在config.js文件,我把这个行:

config.extraPlugins = 'timestamp'; 

我已经关闭了浏览器,使用其他我在几个月内没有使用过的浏览器等等,不管如何,按钮图标从不出现。

我已经使用了这个,并在StackOverflow上阅读了几个Q.许多人谈论过错误的图标或缺失的图标或其他,但这一次,它就在那里,而且完全来自Github。

一旦这个工作,我可以尝试从一个较旧的CKEditor v4.0安装中移除一些插件。谢谢!

回答

0

您还需要将插件添加到ckeditor.replace中。这是一个简单的例子。

<!DOCTYPE html> 
<html> 
    <head> 
     <meta charset="utf-8"> 
     <title>A Simple Page with CKEditor</title> 
     <!-- Make sure the path to CKEditor is correct. --> 
     <script src="ckeditor.js"></script> 
    </head> 
    <body> 
     <form> 
      <textarea name="editor1" id="editor1" rows="10" cols="80"> 
       This is my textarea to be replaced with CKEditor. 
      </textarea> 
      <script> 
       // Replace the <textarea id="editor1"> with a CKEditor 
       // instance, using default configuration. 
       CKEDITOR.replace('editor1', { 
        extraPlugins: 'timestamp' 
       } ); 
      </script> 
     </form> 
    </body> 
</html> 

config.js文件。

CKEDITOR.editorConfig = function(config) { 
    // Define changes to default configuration here. For example: 
    // config.language = 'fr'; 
    // config.uiColor = '#AADC6E'; 

    config.toolbarGroups = [ 
     { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, 
     { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, 
     { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing'] }, 
     { name: 'forms', groups: [ 'forms' ] }, 
     '/', 
     { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, 
     { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph', 'timestamp'] }, 
     { name: 'links', groups: [ 'links' ] }, 
     { name: 'insert', groups: [ 'insert' ] }, 
     '/', 
     { name: 'styles', groups: [ 'styles' ] }, 
     { name: 'colors', groups: [ 'colors' ] }, 
     { name: 'tools', groups: [ 'tools' ] }, 
     { name: 'others', groups: [ 'others' ] }, 
     { name: 'about', groups: [ 'about' ] } 
    ]; 
    config.extraPlugins = 'timestamp'; 
    config.allowedContent = true; 
}; 
+0

谢谢...但可悲的是,你提出的改变也没有效果。工具栏根本没有改变你发布的配置,所以我真的想知道config.js文件是否被读取。我已打开Chrome开发工具并且控制台中没有出现错误。 – RobG

+0

也许尝试再次下载ckeditor。我的配置工作正常http://i.imgur.com/RF0bcfG.png。你肯定在服务器上运行它? – David

+0

下载它新鲜,移动的变化...相同的结果。 config.js肯定被忽略。我知道是因为我在CKEDITOR.replace代码中指定了宽度/高度,当我将它移动到配置文件时,它没有任何作用,并且大小恢复为“stock”。我感谢您的帮助;看起来像我有更大的问题。 – RobG