我使用 tinyMCE 的“removeFormat”从文本中删除格式。我正在使用 removeFormat 的默认值,但它应该保留粗体和带下划线的文本。所以我只是更改了默认值并删除了 b,strong,u:
removeformat: [
{
//selector: 'b,strong,em,i,font,u,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', -> Default
selector: 'em,i,font,strike,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins', // -> Without b,strong,u
remove: 'all',
split: true,
expand: false,
block_expand: true,
deep: true
},
{
selector: 'span',
attributes: [
'style',
'class'
],
remove: 'empty',
split: true,
expand: false,
deep: true
},
{
selector: '*',
attributes: [
'style',
'class'
],
split: false,
expand: false,
deep: true
}
],
这很好用,除了某些文本的格式为:
<span style="text-decoration: underline;">Underlined Text</span>
它也被删除了。在这种情况下,如何更改 removeFormat 以使其保留下划线?