Skip to content

Commit 062c98a

Browse files
authored
fix: 🐛 text breaks on the last word (bubkoo#270)
1 parent d46c6aa commit 062c98a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/cloneNode.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ function cloneCSSStyle<T extends HTMLElement>(nativeNode: T, clonedNode: T) {
8282
target.cssText = source.cssText
8383
} else {
8484
toArray<string>(source).forEach((name) => {
85-
target.setProperty(
86-
name,
87-
source.getPropertyValue(name),
88-
source.getPropertyPriority(name),
89-
)
85+
let value = source.getPropertyValue(name)
86+
87+
if (name === 'font-size' && value.endsWith('px')) {
88+
const reducedFont =
89+
Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1
90+
value = `${reducedFont}px`
91+
}
92+
target.setProperty(name, value, source.getPropertyPriority(name))
9093
})
9194
}
9295
}

0 commit comments

Comments
 (0)