CKEditor为每个实例设置config.toolbar

时间:2015-06-18 02:18:33

标签: javascript ckeditor

我已阅读the guide,但仍不确定如何将toolbar更改为指向其他设置。

我的config.js.coffee

CKEDITOR.editorConfig = (config) ->
  config.extraPlugins = 'lite'
  config.toolbar_Basic = [
    { name: 'clipboard',   items: [ 'PasteText','PasteFromWord','-','Undo','Redo' ] },
    { name: 'editing',     items: [ 'Replace' ] },
    { name: 'basicstyles', items: [ 'Bold','Italic','Underline','Subscript','Superscript' ] },
  config.toolbar_Advanced = [
    { name: 'clipboard',   items: [ 'PasteText','PasteFromWord','-','Undo','Redo' ] },
    { name: 'editing',     items: [ 'Replace' ] },
    { name: 'basicstyles', items: [ 'Bold','Italic','Underline','Subscript','Superscript' ] },
    { name: 'lite', items: [ 'lite-toggletracking', '-', 'lite-acceptall', 'lite-acceptone', '-', 'lite-rejectall', 'lite-rejectone' ] },
  ]
  config.toolbar = 'Basic'
  lite = config.lite = config.lite || {}  
  true

是否有一种简单的方法可以在每个实例的BasicAdvanced工具栏之间进行选择?理想情况下,我可以使用添加到textarea的类。

1 个答案:

答案 0 :(得分:0)

调用CKEditor时,请为个别toolbar实例指定CKEditor,如下所示:

CKEDITOR.replace('editor1', { toolbar: 'Basic' });

CKEDITOR.replace('editor2', { toolbar: 'Advanced' });