Fix bullet points not having leading margin on timeline items (#4536)
* Fix bullet points not having leading margin on timeline items * Remove other usages of `SpannableString` constructor, use either `valueOf` to reuse the existing value or `SpannedString` instead if the spans don't have to change
This commit is contained in:
parent
b1dd555baa
commit
977268b876
5 changed files with 8 additions and 10 deletions
|
|
@ -16,11 +16,11 @@ import io.element.android.libraries.core.extensions.orEmpty
|
|||
|
||||
@Stable
|
||||
class StableCharSequence(initialText: CharSequence = "") {
|
||||
private var value by mutableStateOf<SpannableString>(SpannableString(initialText))
|
||||
private var value by mutableStateOf<SpannableString>(SpannableString.valueOf(initialText))
|
||||
private var needsDisplaying by mutableStateOf(false)
|
||||
|
||||
fun update(newText: CharSequence?, needsDisplaying: Boolean) {
|
||||
value = SpannableString(newText.orEmpty())
|
||||
value = SpannableString.valueOf(newText.orEmpty())
|
||||
this.needsDisplaying = needsDisplaying
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ package io.element.android.libraries.textcomposer.model
|
|||
|
||||
import android.os.Parcelable
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.Spanned
|
||||
import androidx.compose.runtime.Composable
|
||||
|
|
@ -118,8 +117,7 @@ class MarkdownTextEditorState(
|
|||
}
|
||||
|
||||
fun getMentions(): List<IntentionalMention> {
|
||||
val text = SpannableString(text.value())
|
||||
val mentionSpans = text.getMentionSpans()
|
||||
val mentionSpans = text.value().getMentionSpans()
|
||||
return mentionSpans.mapNotNull { mentionSpan ->
|
||||
when (mentionSpan.type) {
|
||||
is MentionType.User -> IntentionalMention.User(mentionSpan.type.userId)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue