From 6a30a2ed323cc6d54c903ccf17a2e9f59f28e3b6 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 31 Jan 2024 18:18:36 +0100 Subject: [PATCH] Keep the current message formatting when switching between composer mode (Regular, Reply, etc.) --- .../home/room/detail/composer/MessageComposerFragment.kt | 2 +- .../home/room/detail/composer/MessageComposerViewModel.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt index de6208c7a2..038f009d22 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerFragment.kt @@ -404,7 +404,7 @@ class MessageComposerFragment : VectorBaseFragment(), A } override fun onTextChanged(text: CharSequence) { - messageComposerViewModel.handle(MessageComposerAction.OnTextChanged(text)) + messageComposerViewModel.handle(MessageComposerAction.OnTextChanged(composer.formattedText ?: text)) } override fun onFullScreenModeChanged() = withState(messageComposerViewModel) { state -> diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt index 648c88b4d2..fbf943855e 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/composer/MessageComposerViewModel.kt @@ -151,7 +151,7 @@ class MessageComposerViewModel @AssistedInject constructor( private fun handleOnTextChanged(action: MessageComposerAction.OnTextChanged) { val needsSendButtonVisibilityUpdate = currentComposerText.isBlank() != action.text.isBlank() - currentComposerText = SpannableString(action.text) + currentComposerText = action.text if (needsSendButtonVisibilityUpdate) { updateIsSendButtonVisibility(true) }