TinyMCE iframe 编码内容

TinyMCE iframe encodes contents

将带有 HTML 内容而不是 src 属性的 iframe 插入 TinyMCE 会对所有内容进行编码并破坏内容。

例如:通过查看源代码或嵌入插件插入:

<iframe><p>hello</p></iframe>

当您再次查看源代码时会出现这样的结果:

<iframe width="300" height="150" data-mce-fragment="1">&amp;lt;P&amp;gt;hello&amp;lt;/p&amp;gt;</iframe>

有什么方法可以阻止这种情况或 init 中导致这种情况的设置吗?

如果有人想知道为什么我需要这个而不是使用 src,那是因为我正在尝试为 Facebook 的新 Instant Article 东西格式化文章,它需要嵌入 posts/tweets 等来包装<figure><iframe>[code]</iframe></figure> 格式。

我想通了为什么会发生这种情况,因为我试图通过在 fiddle.tinymce.com. This encoding issue didn't happen on the fiddle, so I stripped back my own init thinking it was maybe the codemirror plugin, but it turned out to be the fontawesome 2.0.6 插件 上进行测试来缩小问题范围(现在是 2.0.8,但我无法让那个版本工作所以我不确定它是否改变了自 2.0.6 以来的工作方式。

该插件在 BeforeSetContentGetContent 上执行 var content = parser.parseFromString(e.content, 'text/html'); 以执行一些不可编辑的 class 更改。这导致某些 HTML 元素在源代码中被编码。

长话短说,我删除了解析器并修改了插件,我的问题就解决了!