Skip to content

Commit 7c6c3fa

Browse files
FrakcoolJesus Sanchez
andauthored
Fix suffix check (#2982)
* Fix suffix check * Fix build failure due to let rather than const --------- Co-authored-by: Jesus Sanchez <jesussa@microsoft.com>
1 parent 0b0c592 commit 7c6c3fa

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/roosterjs-content-model-dom/lib/modelApi/editing/retrieveModelFormatState.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,13 @@ function mergeValue<K extends keyof ContentModelFormatState>(
276276
}
277277

278278
function px2Pt(px: string) {
279-
if (px && px.indexOf('px') == px.length - 2) {
280-
// Edge may not handle the floating computing well which causes the calculated value is a little less than actual value
281-
// So add 0.05 to fix it
282-
return Math.round(parseFloat(px) * 75 + 0.05) / 100 + 'pt';
279+
if (px) {
280+
const index = px.indexOf('px');
281+
if (index !== -1 && index === px.length - 2) {
282+
// Edge may not handle the floating computing well which causes the calculated value to be a little less than the actual value
283+
// So add 0.05 to fix it
284+
return Math.round(parseFloat(px) * 75 + 0.05) / 100 + 'pt';
285+
}
283286
}
284287
return px;
285-
}
288+
}

0 commit comments

Comments
 (0)