【问题标题】:Remove "Source" from CKEditor UI Source Dialog plugin从 CKEditor UI 源对话框插件中删除“源”
【发布时间】:2017-06-23 18:57:59
【问题描述】:

我正在使用 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,我不想加载它而不是删除它。

【问题讨论】:

    标签: javascript jquery plugins ckeditor ckeditor4.x


    【解决方案1】:

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

    .cke_button__source_label {
        display: none !important;
    }
    

    .cke_button_label.cke_button__source_label {
        display: none;
    }
    

    另请参阅此答案:https://stackoverflow.com/a/8487229/4708866

    【讨论】:

      【解决方案2】:

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

      config.removeButtons = 'Source';
      

      【讨论】:

      • 这会删除整个按钮,而不仅仅是标签。
      猜你喜欢
      • 1970-01-01
      • 2013-11-11
      • 1970-01-01
      • 1970-01-01
      • 2012-02-11
      • 2023-02-10
      • 1970-01-01
      • 1970-01-01
      • 2010-10-30
      相关资源
      最近更新 更多