-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
spamAuto-marked as spamAuto-marked as spam
Description
实现场景:
使用<!--[if mso]>
存在的问题:
在 TinyMCE 富文本编辑器中使用 MSO 条件注释<!--[if mso]>时,出现了被自动格式化为<!-- [if mso]>(注释标签与[if mso]之间多了空格)的问题,这会导致 Outlook 等 MSO 客户端无法识别该条件注释
当前方案:
AI提供了多种解决方案,测试后只有以下这种是可以用的。但是在amis的富文本编辑器内要如何配置setup属性,直接转换为json配置在options里面是不生效的。
tinymce.init({
selector: '#editor',
height: 400,
language: 'zh_CN',
plugins: 'code',
toolbar: 'code',
setup: function(editor) {
editor.on('BeforeSetContent', function(e) {
// 强制将<!-- [if mso]> 还原为 <!--[if mso]>
e.content = e.content.replace(/<!--\s+\[if mso\]>/g, '<!--[if mso]>');
e.content = e.content.replace(/<!\[endif\]-->/g, '<![endif]-->');
});
editor.on('GetContent', function(e) {
// 获取内容时再次确保无空格
e.content = e.content.replace(/<!--\s+\[if mso\]>/g, '<!--[if mso]>');
});
}
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
spamAuto-marked as spamAuto-marked as spam