Skip to content

Commit 5eb8b20

Browse files
committed
Fix bullet item selection crash
1 parent 8e36a88 commit 5eb8b20

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

editor/src/main/java/com/canopas/editor/ui/data/QuillTextManager.kt

+3-11
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,10 @@ class QuillTextManager(quillSpan: QuillSpan) {
178178
)
179179
}
180180

181-
if (currentSpan != null) {
182-
if (
183-
currentSpan.style.contains(TextSpanStyle.BulletStyle) &&
184-
editable[selection.min - 1] == '\n' &&
185-
editable[selection.min - 2] != '\n'
186-
) {
181+
if (currentSpan != null && this.selection.collapsed) {
182+
if (editable[selection.min - 1] == '\n' && editable[selection.min - 2] != '\n') {
187183
addStyle(TextSpanStyle.BulletStyle)
188-
} else if (
189-
currentSpan.style.contains(TextSpanStyle.BulletStyle) &&
190-
editable[selection.min - 1] == '\n' &&
191-
editable[selection.min - 2] == '\n'
192-
) {
184+
} else if (editable[selection.min - 1] == '\n' && editable[selection.min - 2] == '\n') {
193185
removeStyle(TextSpanStyle.BulletStyle)
194186
} else {
195187
this.currentStyles.addAll(currentStyles)

editor/src/main/java/com/canopas/editor/ui/utils/ElementsSpanStyle.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ sealed interface TextSpanStyle {
9999

100100
object H2Style : TextSpanStyle {
101101
override val key: String
102-
get() = "h3"
102+
get() = "h2"
103103
override val style: Any
104104
get() = RelativeSizeSpan(1.4f)
105105

0 commit comments

Comments
 (0)