簡體   English   中英

從 CKEditor UI 源對話框插件中刪除“源”

[英]Remove "Source" from CKEditor UI Source Dialog plugin

我正在使用 CKEditor(v4.7.0 - 自定義構建),並且添加了 Source Dialog 插件( http://ckeditor.com/addon/sourcedialog )。

從工具欄 UI 中刪除“源”一詞的最佳方法是什么?

例如從這個:

在此處輸入圖像描述

對此:

在此處輸入圖像描述

我正在使用 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(' ');

但這感覺有點hacktastic,我不想加載它而不是刪除它。

您可以隱藏標簽並僅保留帶有 CSS 的圖標:

.cke_button__source_label {
    display: none !important;
}

或者

.cke_button_label.cke_button__source_label {
    display: none;
}

另請參閱此答案: https ://stackoverflow.com/a/8487229/4708866

只需將此行包含在您的 config.js 中

config.removeButtons = 'Source';

或從如下替換方法:

CKEDITOR.replace('exampleEditor1', {
   removeButtons: 'Source',
   extraPlugins: 'sourcedialog'
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM