CKEditor 自定义 ACF 禁用所有插件

CKEditor Custom ACF disabling all plugins

我试图在我的 ck 编辑器中设置一个明确的允许内容列表,但我的列表似乎不够包容,因为我几乎所有的插件都被禁用了。如果我将 ACF 设置回自动(删除 allowedContent),那么所有插件都会恢复。这是我在 config.js

中的 allowedConent
config.allowedContent = 
{
     h1: true,
     h2: true,
     h3: true,
     'span, p, ul, ol, li,': {
         styles: 'color, margin-left, margin-right, font-size'
     },
     'a[!href,target,name]': true,
     b: true,
     u: true,
     i: true,
}

然而,唯一似乎启用的按钮是粗体、下划线和斜体。我想弄清楚为什么我的其他插件不起作用。例如,link 插件具有以下内容:

var allowed = 'a[!href]',
required = 'a[href]';

// Add the link and unlink buttons.
editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link', {
    allowedContent: allowed,
    requiredContent: required
} ) );
editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor', {
    allowedContent: 'a[!name,id]',
    requiredContent: 'a[name]'
} ) );

如您所见,我已经定义了必要属性的锚点(带有 href 和名称的锚点),但按钮没有显示!我已经通过打印 CKEDITOR.instances["editor-1"].filter.allowedContent 验证了我的语法正确,它显示了我期望的对象。我也试过添加一堆常见元素,比如看看添加其中一个元素是否会恢复插件,但事实并非如此。那我错过了什么?

好吧,我似乎混合了我的对象语法和字符串语法。更正此问题后,锚点和字体大小按钮开始出现。以下是我目前所拥有的:

config.allowedContent = 
{
     h1: true,
     h2: true,
     h3: true,
     a: {
        attributes: ['!href','target','name']
     }, 
     b: true,
     u: true,
     i: true,
     // font-size
     span: {
         styles: { 'font-size': '#(size)' },
         overrides: [ { element :'font', attributes: { 'size': null } } ]
     }
}

我仍然需要找出 font-color 和其他一些的正确定义,但这只是检查插件代码并查看它们期望的问题。