javascript - 如何在ckeditor中自定义工具栏?

标签 javascript ckeditor

我的 CKEDITOR 有问题。我尝试自定义工具栏以仅包含我想要的按钮,但是当我尝试将工具栏放入代码中时,我的网络应用程序上的 ckeditor 中没有工具栏。我的意思是我的 ckeditor 已创建,但没有工具栏。

这是我的 JavaScript 代码:

var editor = CKEDITOR.replace( 'professionnal_mailtemplate_response_template', {
     toolbar: [

         { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat', 'TextColor', 'BGColor' ] },
         { name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
         { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
         { name: 'links', items: [ 'Link' ] }
     ]
 } );

 CKFinder.setupCKEditor( editor, '/../js/ckfinder/' )

有人可以帮助我吗?因为我搜索过,但暂时没有发现问题所在。

提前致谢!!!

最佳答案

我相信,使用此配置,您需要使用 toolbarGroups 属性,而不是 toolbar:

var editor = CKEDITOR.replace( 'professionnal_mailtemplate_response_template', {
     toolbarGroups: [
         { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat', 'TextColor', 'BGColor' ] },
         { name: 'insert', items: [ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] },
         { name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
         { name: 'links', items: [ 'Link' ] }
     ]
 } );

关于javascript - 如何在ckeditor中自定义工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48323319/

相关文章:

javascript - Ckeditor 强制自定义样式属性到特定元素

javascript - 几乎递增的序列码信号

javascript - 未处理的 Promise 拒绝 : Cannot read property 'push' of undefined Value

javascript - 点击取消按钮后停留在当前页面

javascript - 突出显示与 Perl 正则表达式匹配的 HTML 部分 - 在服务器端 Perl 或客户端 javascript 中执行吗?

javascript - ckeditor 在 IE6/7/8 中不显示光标?

parsing - 从 Word 粘贴时,如何阻止 CKEditor 用双 <br> 替换段落

javascript - CKEditor 如何在小部件中允许 href ="javascript:void(0)"

javascript - string.replace() 与 global (g) 不以奇怪的方式工作

python - Ckeditor 在创建后仍然隐藏 - editor.css 为空