将自定义按钮添加到没有插件的CKEditor 4.6.2实例

将自定义按钮添加到没有插件的CKEditor 4.6.2实例,ckeditor,Ckeditor,我需要添加一个自定义按钮到没有插件的CKEditor 4.6.2实例 我试过类似问题的解决方案 区别在于我不想替换现有实例,而是在初始化后修改它。就像这里: 但在这种情况下,按钮没有出现。我也面临同样的问题,这就是我解决问题的方法- var editor = CKEDITOR.replace(ck, { toolbar: [['Source','-','Preview','Print'],['UIColor','Maximize','ShowBlocks'],

我需要添加一个自定义按钮到没有插件的CKEditor 4.6.2实例

我试过类似问题的解决方案

区别在于我不想替换现有实例,而是在初始化后修改它。就像这里:


但在这种情况下,按钮没有出现。

我也面临同样的问题,这就是我解决问题的方法-

 var editor = CKEDITOR.replace(ck, {
    toolbar: [['Source','-','Preview','Print'],['UIColor','Maximize','ShowBlocks'],
                  ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo','RemoveFormat','-','Link','Unlink','Anchor'],
                  ['Bold','Italic','Underline','Strike','Subscript','Superscript','RemoveFormat'],['Link','Unlink','Anchor'], '/',
                  ['NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
                  ['Styles','Format','Font','FontSize'],['TextColor','BGColor'],'/',
                  {name: 'insert', items:['InsertCustomImage','Flash','Table','Iframe','HorizontalRule','Smiley','SpecialChar','PageBreak']}]   
    });

editor.addCommand("insertImgCmd", {
        exec: function(edt) {
            helper.showdlg(component);
        }
    });
    editor.ui.addButton('InsertCustomImage', {
        label: "Insert Image",
        command: 'insertImgCmd',
        toolbar: 'insert',
        icon: 'https://avatars1.githubusercontent.com/u/5500999?v=2&s=16'
    });
在设置工具栏时,我插入了一个自定义命令名“InsertCustomImage”。 现在,在下面创建新按钮时,在addButton函数中设置与“InsertCustomImage”相同的名称

 var editor = CKEDITOR.replace(ck, {
    toolbar: [['Source','-','Preview','Print'],['UIColor','Maximize','ShowBlocks'],
                  ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo','RemoveFormat','-','Link','Unlink','Anchor'],
                  ['Bold','Italic','Underline','Strike','Subscript','Superscript','RemoveFormat'],['Link','Unlink','Anchor'], '/',
                  ['NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
                  ['Styles','Format','Font','FontSize'],['TextColor','BGColor'],'/',
                  {name: 'insert', items:['InsertCustomImage','Flash','Table','Iframe','HorizontalRule','Smiley','SpecialChar','PageBreak']}]   
    });

editor.addCommand("insertImgCmd", {
        exec: function(edt) {
            helper.showdlg(component);
        }
    });
    editor.ui.addButton('InsertCustomImage', {
        label: "Insert Image",
        command: 'insertImgCmd',
        toolbar: 'insert',
        icon: 'https://avatars1.githubusercontent.com/u/5500999?v=2&s=16'
    });