Skip to content

Commit 5f4e56b

Browse files
committed
Remove markup and clickable span as well
1 parent c703c6c commit 5f4e56b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,15 @@ class AztecText : EditText, TextWatcher {
903903
text.getSpans(0, text.length, AztecMediaSpan::class.java).forEach {
904904
if (it.attributes != null) {
905905
if (attributePredicate.matches(it.attributes as Attributes)) {
906+
val start = text.getSpanStart(it)
907+
val end = text.getSpanEnd(it)
908+
909+
val clickableSpan = text.getSpans(start, end, AztecMediaClickableSpan::class.java).firstOrNull()
910+
911+
text.removeSpan(clickableSpan)
906912
text.removeSpan(it)
913+
914+
text.delete(start, end)
907915
}
908916
}
909917
}

0 commit comments

Comments
 (0)