Skip to content

Commit ada6502

Browse files
committed
fix: 修复文本的高度解析
1 parent 3d2d99f commit ada6502

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/parser/text.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ const transformToText = (node: Element): Text | Text[] | undefined => {
2121
child.nodeType === Node.TEXT_NODE && child.nodeValue!.trim().length > 0
2222
)
2323
.map((textNode) => {
24-
const { lines } = getTextContext(textNode);
24+
const { lines, textBCR } = getTextContext(textNode);
2525
let { x, y, width: textWidth, height } = getTextAbsBCR(node, textNode);
2626

2727
const { display, whiteSpace, overflow, textOverflow, width } = styles;
2828

2929
if (display === 'inline') {
30-
textStyle.lineHeight = height;
30+
textStyle.lineHeight = textBCR.height;
3131
}
3232
// **** 处理文本 ****** //
3333

0 commit comments

Comments
 (0)