防止 TinyMCE 在 HTML 评论中添加空格

Prevent TinyMCE from adding spaces within HTML comments

对于电子邮件,我使用条件注释以便对 Outlook '07+ 进行 UI 调整。在 TinyMCE 中保存时,它会添加一个 space changing

这个

<!--[if gte mso 9]>

至此

<!-- [if gte mso 9]>(在[之前加上space)

Outlook 不再解释它。

知道 TinyMCE 中是否有设置来阻止此更改吗?

--

次要:如果这很容易添加,我希望评论也不要移到上一行,但也找不到设置。

示例:

Some text
<!-- Outlook hack here -->
<!--[if gte mso 9]>
<tag>

不应该变成

Some text <!-- Outlook hack here --> <!-- [if gte mso 9]>
<tag>

我们遇到了这个问题并通过添加

解决了它

allow_conditional_comments: 真

下面的示例直接取自文档:https://www.tiny.cloud/docs/configure/content-filtering/

tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  allow_conditional_comments: true
});

我不确定如何最好地解决第二个问题。