简体   繁体   English

防止TinyMCE在HTML注释中添加空格

[英]Prevent TinyMCE from adding spaces within HTML comments

For emails I use conditional comments in order to make UI adjustments for Outlook '07+. 对于电子邮件,我使用条件注释来对Outlook '07 +进行UI调整。 When saving in TinyMCE it adds a space changing 在TinyMCE中保存时,它会增加一个空间

this 这个

<!--[if gte mso 9]>

to this 对此

<!-- [if gte mso 9]> (with space before the [ ) <!-- [if gte mso 9]> (在[之前有空格<!-- [if gte mso 9]>

which doesn't get interpreted by Outlook anymore. Outlook不再对其进行解释。

Any idea if there is a setting in TinyMCE to prevent this change? 知道在TinyMCE中是否有设置可以阻止此更改?

-- -

Secondary: In case this is easy to add, I'd ideally would like comments to also not be moved to the previous line, but couldn't find a setting for this either. 次要的:如果易于添加,则理想情况下,我也希望注释也不要移至上一行,但也找不到此设置。

Example: 例:

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

should not become 不应该成为

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

We had this problem and solved it by adding 我们遇到了这个问题,并通过添加解决了

allow_conditional_comments: true allow_conditional_comments:true

Example below taken directly from the documentation: https://www.tiny.cloud/docs/configure/content-filtering/ 以下示例直接取自文档: https : //www.tiny.cloud/docs/configure/content-filtering/

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

I'm not sure how to best solve the second question. 我不确定如何最好地解决第二个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM