我将CKEditor 4.7与Shared Space插件结合使用 . 在我的页面中,我有多个CKEditor文本块和一些纯文本输入 . 我使用了共享空间插件,因此工具栏将始终位于页面顶部 . 不幸的是,当焦点不在CKEditor字段上时,共享空间插件不会禁用工具栏(这是一种非常糟糕的UI体验) .

因此,为了解决这个问题,我添加了一个自定义插件,在编辑器模糊时禁用所有按钮,并在获得焦点时再次启用它 . 所有工作都很漂亮,除了有几个顽固的按钮不会禁用,即使新选择不提供他们可以使用的任何上下文 .

这些是: colorbutton, format and spellchecker.

enter image description here

我只是不明白为什么这些小捣蛋鬼不会遵守?

CKEDITOR.plugins.add('common', {
    init: function( editor ) {
        editor.on('blur', function() {
            Object.keys(editor.commands).forEach(function (key){
                editor.commands[key].disable();
            });
        });

        editor.on('focus', function() {
            Object.keys(editor.commands).forEach(function (key){
                editor.commands[key].enable();
            });
        });
    }
} );