mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 02:39:55 +01:00
Fix rendering when editing a message with spoilers.
This commit is contained in:
@@ -261,6 +261,22 @@ object MessageStyler {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun convertSpoilersToComposeMode(text: Spannable) {
|
||||
SpoilerAnnotation.getSpoilerAndClickAnnotations(text)
|
||||
.forEach { (spoiler, clickSpan) ->
|
||||
val start = text.getSpanStart(spoiler)
|
||||
val end = text.getSpanEnd(spoiler)
|
||||
val convertedSpoiler = copyStyleSpan(spoiler, start, end - start)
|
||||
text.removeSpan(spoiler)
|
||||
text.setSpan(convertedSpoiler, start, end, SPAN_FLAGS)
|
||||
|
||||
if (clickSpan != null) {
|
||||
text.removeSpan(clickSpan)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Any.isSupportedStyle(): Boolean {
|
||||
return when (this) {
|
||||
is CharacterStyle -> isSupportedCharacterStyle()
|
||||
|
||||
Reference in New Issue
Block a user