阻止 ckeditor 添加非 amp 代码

Stop ckeditor from adding non amp codes

有没有办法让ckeditor兼容AMP? ckeditor 不断向破坏 AMP 的图像标签添加内联样式。

如果您不能对在 CKEditor 中创建的内容使用任何内联样式,请尝试使用以下方法(无法禁用高级内容过滤器 (ACF) 才能正常工作):

var editor = CKEDITOR.replace( 'editor1', {
        allowedContent : {
            : {
                // This will set the default set of elements.
                elements: CKEDITOR.dtd,
                attributes: true,
                styles: false,
                classes: true
            }
        }
});

如果您只想禁止图片样式,请使用:

var editor = CKEDITOR.replace( 'editor1', {             
                 disallowedContent : 'img{width,height}'
});

要了解有关 ACF 的更多信息,请参阅: