Skip to content

Commit 0465ffe

Browse files
authored
Merge pull request #1344 from elangbamjohnson/fix/fix-li-tag-when-switching-list-style
Fix Li tag when switching the list style (issue #1307)
2 parents 7b7c3b0 + 5d4042d commit 0465ffe

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

Aztec/Classes/TextKit/TextView.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,8 +1111,12 @@ open class TextView: UITextView {
11111111
toggle(formatter: formatter, atRange: range)
11121112

11131113
let liFormatter = LiFormatter(placeholderAttributes: typingAttributes)
1114-
toggle(formatter: liFormatter, atRange: range)
1114+
let isOlTagPresent = formatter.present(in: storage, at: range)
1115+
let isLiTagPresent = liFormatter.present(in: storage, at: range)
11151116

1117+
if isOlTagPresent != isLiTagPresent {
1118+
toggle(formatter: liFormatter, atRange: range)
1119+
}
11161120
forceRedrawCursorAfterDelay()
11171121
}
11181122

@@ -1128,8 +1132,12 @@ open class TextView: UITextView {
11281132
toggle(formatter: formatter, atRange: range)
11291133

11301134
let liFormatter = LiFormatter(placeholderAttributes: typingAttributes)
1131-
toggle(formatter: liFormatter, atRange: range)
1132-
1135+
let isOlTagPresent = formatter.present(in: storage, at: range)
1136+
let isLiTagPresent = liFormatter.present(in: storage, at: range)
1137+
1138+
if isOlTagPresent != isLiTagPresent {
1139+
toggle(formatter: liFormatter, atRange: range)
1140+
}
11331141
forceRedrawCursorAfterDelay()
11341142
}
11351143

0 commit comments

Comments
 (0)