Improve message rendering when editing (#8377)

This commit is contained in:
Yoan Pintas 2023-05-02 15:28:31 +02:00 committed by GitHub
parent 8ca0381e9b
commit 9347de3fad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

1
changelog.d/748.bugfix Normal file
View file

@ -0,0 +1 @@
User pills get lost at message editing

View file

@ -205,10 +205,10 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
return@onEach
}
when (mode) {
is SendMode.Regular -> renderRegularMode(mode.text.toString())
is SendMode.Edit -> renderSpecialMode(MessageComposerMode.Edit(mode.timelineEvent, mode.text.toString()))
is SendMode.Quote -> renderSpecialMode(MessageComposerMode.Quote(mode.timelineEvent, mode.text.toString()))
is SendMode.Reply -> renderSpecialMode(MessageComposerMode.Reply(mode.timelineEvent, mode.text.toString()))
is SendMode.Regular -> renderRegularMode(mode.text)
is SendMode.Edit -> renderSpecialMode(MessageComposerMode.Edit(mode.timelineEvent, mode.text))
is SendMode.Quote -> renderSpecialMode(MessageComposerMode.Quote(mode.timelineEvent, mode.text))
is SendMode.Reply -> renderSpecialMode(MessageComposerMode.Reply(mode.timelineEvent, mode.text))
is SendMode.Voice -> renderVoiceMessageMode(mode.text)
}
}

View file

@ -209,7 +209,13 @@ class PlainTextComposerLayout @JvmOverloads constructor(
avatarRenderer.render(event.senderInfo.toMatrixItem(), views.composerRelatedMessageAvatar)
views.composerEditText.setText(defaultContent)
val content = if (specialMode is MessageComposerMode.Edit) {
formattedBody ?: defaultContent
} else {
defaultContent
}
views.composerEditText.setText(content)
expand {
// need to do it here also when not using quick reply