iframe 在使用我的 ckeditor5 配置的编辑器渲染期间消失

问题描述

我正在构建ckeditor的经典配置。用几个插件定制。哦,这个插件htmlEmbed。这个插件允许我添加 HTML 片段。因此,例如,我可以添加以下内容

<iframe width="560" height="315" src="https://www.youtube.com/embed/SKLuEuO775Q" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

我可以看到预览。而且我还可以保存内容内容保存在里面

<div class="raw-html-embed">

现在我将内容保存到一个 MysqL 表中。数据库的种类在这里没有影响。

<div class="raw-html-embed"><iframe width="560" height="315" src="https://www.youtube.com/embed/SKLuEuO775Q" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>

我可以在浏览器中呈现此内容并查看 iframe。但是如果我再次打开编辑器,这个内容就会消失,取而代之的是:

<div class="raw-html-embed"><br data-cke-filler="true"></div>

换句话说,内容

<div class="raw-html-embed"><iframe width="560" height="315" src="https://www.youtube.com/embed/SKLuEuO775Q" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>

成为

<div class="raw-html-embed"><br data-cke-filler="true"></div>

我试过允许 iframe 使用

    ClassicEditor.create(document.getElementById(theEditor.id),{
        allowedContent: 'iframe[*]',config: {
            extraAllowedContent: 'iframe[*]',}

但恐怕这是 ckeditor4 的配置而不是 ckeditor 的配置。

换句话说。有人可以解释我如何在元素内呈现 ckeditor5 时保留 iframe 标签吗?希望这个问题足够详细。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)