Feat:修改tryAddHtmlStyle方法的逻辑

This commit is contained in:
街角小林
2024-12-03 17:52:23 +08:00
parent 508d8fe357
commit fbb3b47b7d

View File

@@ -127,14 +127,15 @@ function createIconNode() {
// 尝试给html指定标签添加内联样式
function tryAddHtmlStyle(text, style) {
const tagList = ['span', 'strong', 's', 'em', 'u']
let _text = text
for (let i = 0; i < tagList.length; i++) {
text = addHtmlStyle(text, tagList[i], style)
if (text !== _text) {
break
}
}
return text
// let _text = text
// for (let i = 0; i < tagList.length; i++) {
// text = addHtmlStyle(text, tagList[i], style)
// if (text !== _text) {
// break
// }
// }
// return text
return addHtmlStyle(text, tagList, style)
}
// 创建富文本节点