CKeditor setData()方法正在省略图像

CKeditor setData() method is omitting images

本文关键字:略图 图像 方法 setData CKeditor      更新时间:2023-09-26

在CKEditor中设置数据时,图像会在编辑器区域中消失。链接和其他格式是可以的,所以看起来不像是双引号的东西。此外,我尝试了绝对定位和外部图像,所以这不是一个图像未找到的问题。

这是我的代码:

function getContent(id)
{
    console.log($('#content-article-' + id).html());
    return $('#content-article-' + id).html();
}
function enableEdition()
{
    if (current_conclusion != 'NEW')
    {
        $('#titular-edit').val(getTitle(current_article));
        //This setData() sets everthing but images
        CKEDITOR.instances.editor.setData(getContent(current_article));
    }
}

编辑器iframe 内的<br>标记替换了图像标记

CKEditor 4.1附带了高级内容过滤器,这是问题的根源。很可能您没有使用将<img>添加到allowedContent规则中的图像插件(不是吗?)。这就是编辑器从您的内容中丢弃这些标签的原因,也是您必须手动配置它的原因。

请参阅相关答案:停止CKEditor删除div,CKEditor剥离内联属性