Skip to content

Commit 32b21c2

Browse files
committed
Handle future change in EditContext text format string values
1 parent 5559e00 commit 32b21c2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/domobserver.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,13 @@ class EditContextManager {
606606
let deco = []
607607
for (let format of e.getTextFormats()) {
608608
let lineStyle = format.underlineStyle, thickness = format.underlineThickness
609-
if (lineStyle != "None" && thickness != "None") {
609+
if (!/none/i.test(lineStyle) && !/none/i.test(thickness)) {
610610
let from = this.toEditorPos(format.rangeStart), to = this.toEditorPos(format.rangeEnd)
611611
if (from < to) {
612+
// These values changed from capitalized custom strings to lower-case CSS keywords in 2025
612613
let style = `text-decoration: underline ${
613-
lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""
614-
}${thickness == "Thin" ? 1 : 2}px`
614+
/^[a-z]/.test(lineStyle) ? lineStyle + " " : lineStyle == "Dashed" ? "dashed " : lineStyle == "Squiggle" ? "wavy " : ""
615+
}${/thin/i.test(thickness) ? 1 : 2}px`
615616
deco.push(Decoration.mark({attributes: {style}}).range(from, to))
616617
}
617618
}

0 commit comments

Comments
 (0)