Skip to content

Commit 714318b

Browse files
fix: remove background color spans when removing inline CSS styles
1 parent 25a55b6 commit 714318b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/formatting/InlineFormatter.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package org.wordpress.aztec.formatting
22

33
import android.graphics.Typeface
44
import android.text.Spanned
5+
import android.text.style.BackgroundColorSpan
56
import android.text.style.ForegroundColorSpan
67
import android.text.style.StyleSpan
78
import androidx.annotation.ColorRes
@@ -323,8 +324,10 @@ class InlineFormatter(editor: AztecText, val codeStyle: CodeStyle, private val h
323324
}
324325

325326
private fun removeInlineCssStyle(start: Int = selectionStart, end: Int = selectionEnd) {
326-
val spans = editableText.getSpans(start, end, ForegroundColorSpan::class.java)
327-
spans.forEach {
327+
editableText.getSpans(start, end, ForegroundColorSpan::class.java).forEach {
328+
editableText.removeSpan(it)
329+
}
330+
editableText.getSpans(start, end, BackgroundColorSpan::class.java).forEach {
328331
editableText.removeSpan(it)
329332
}
330333
}

0 commit comments

Comments
 (0)