Merge pull request #8743 from element-hq/feature/bma/editorIssue

Fix Rich Text Editor issues: save formatted text in draft and keep formatting when switching between modes
This commit is contained in:
ganfra 2024-05-28 10:52:51 +02:00 committed by GitHub
commit 22f69ec6b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

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

@ -0,0 +1 @@
Restore formatting when restoring a draft. Also keep formatting when switching composer mode.

View file

@ -47,6 +47,7 @@ import com.vanniktech.emoji.EmojiPopup
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.error.fatalError
import im.vector.app.core.extensions.orEmpty
import im.vector.app.core.extensions.registerStartForActivityResult
import im.vector.app.core.extensions.showKeyboard
import im.vector.app.core.glide.GlideApp
@ -255,7 +256,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
it.isRecordingVoiceBroadcast && !requireActivity().isChangingConfigurations -> timelineViewModel.handle(VoiceBroadcastAction.Recording.Pause)
else -> {
timelineViewModel.handle(VoiceBroadcastAction.Listening.Pause)
messageComposerViewModel.handle(MessageComposerAction.OnEntersBackground(composer.text.toString()))
messageComposerViewModel.handle(MessageComposerAction.OnEntersBackground(composer.formattedText ?: composer.text.orEmpty().toString()))
}
}
}
@ -403,7 +404,7 @@ class MessageComposerFragment : VectorBaseFragment<FragmentComposerBinding>(), A
}
override fun onTextChanged(text: CharSequence) {
messageComposerViewModel.handle(MessageComposerAction.OnTextChanged(text))
messageComposerViewModel.handle(MessageComposerAction.OnTextChanged(composer.formattedText ?: text))
}
override fun onFullScreenModeChanged() = withState(messageComposerViewModel) { state ->