fix: strikeout style rendering position #498

This commit is contained in:
Hufe921
2024-04-04 19:03:58 +08:00
parent 9ad991a393
commit 46e153d588
5 changed files with 68 additions and 13 deletions
+8 -1
View File
@@ -754,6 +754,9 @@ export function convertElementToDom(
if (element.underline) {
dom.style.textDecoration = 'underline'
}
if (element.strikeout) {
dom.style.textDecoration += ' line-through'
}
dom.innerText = element.value.replace(new RegExp(`${ZERO}`, 'g'), '\n')
return dom
}
@@ -981,9 +984,13 @@ export function convertTextNodeToElement(
element.highlight = style.backgroundColor
}
// 下划线
if (style.textDecorationLine === 'underline') {
if (style.textDecorationLine.includes('underline')) {
element.underline = true
}
// 删除线
if (style.textDecorationLine.includes('line-through')) {
element.strikeout = true
}
return element
}