从CKEditor UI Source Dialog插件中删除“Source”

时间:2017-06-23 18:57:59

标签: javascript jquery plugins ckeditor ckeditor4.x

我正在使用CKEditor(v4.7.0 - 自定义版本),我添加了源对话插件(http://ckeditor.com/addon/sourcedialog)。

从工具栏用户界面中删除“来源”一词的最佳方法是什么?

e.g。从这个:

enter image description here

对此:

enter image description here

我正在使用jQuery适配器并初始化编辑器:

$(el).ckeditor({
    removePlugins: 'maximize,floatingspace,resize',
    extraPlugins: 'autogrow,sharedspace,sourcedialog',
    autoGrow_onStartup: true,
    toolbarGroups: { name: 'main', groups: [ 'mode', 'document', 'doctools', 'find', 'selection', 'spellchecker', 'editing', 'clipboard', 'undo', 'forms', 'links', 'insert', 'basicstyles', 'cleanup', 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph', 'styles', 'tools', 'colors' ] },
    autoGrow_maxHeight: 800,
    sharedSpaces: {
        top: 'editorActions',
        bottom: 'editorFooter'
    },
    on: {
        blur: function(evt) {
            // blur functions
        },
        instanceReady: function (evt) {
            // initial functions
        },
        change: function(evt) {
            // save functions
        }
    }
});

目前我只是通过定位加载元素来删除文本。

$('#cke_[id]_label').html(' ');

但这感觉有点不太讨厌,我不想加载而不是删除它。

2 个答案:

答案 0 :(得分:3)

您可以隐藏标签,只留下带有CSS的图标:

.cke_button__source_label {
    display: none !important;
}

.cke_button_label.cke_button__source_label {
    display: none;
}

另见答案:https://stackoverflow.com/a/8487229/4708866

答案 1 :(得分:-1)

只需在config.js中包含此行

即可
config.removeButtons = 'Source';