Fix Rich Text Editor issues: save formatted text in draft and keep formatting when switching between modes#8743
Conversation
…ode (Regular, Reply, etc.)
|
It looks like it's breaking some computation with the send button visibility... There is some scenarios where the send button never shows up. On develop I can't reproduce, but the send button is blinking when typing text (with RTE enabled). |
I cannot repro the issue of send button not visible. Can you be more precise about the scenario to repro please? |
@ganfra what is the scenario where the send button disappears? about the blinking, I think this was fixed by #8770. |
| private fun handleOnTextChanged(action: MessageComposerAction.OnTextChanged) { | ||
| val needsSendButtonVisibilityUpdate = currentComposerText.isBlank() != action.text.isBlank() | ||
| currentComposerText = SpannableString(action.text) | ||
| currentComposerText = action.text |
There was a problem hiding this comment.
@bmarty Why are u doing that?
As it uses the CharSequence from the editor, it'll break the needsSendButtonVisibilityUpdate as currentComposerText will always be equals to action.text.
Reverting the change still allow to keep formatting when switching mode as far as I see.
There was a problem hiding this comment.
You're right, it is a mistake to change this. Reverted in 2395d72
Type of change
Content
Motivation and context
Avoid formatting loses.
Closes #7466
Screenshots / GIFs
Tests
Enable the RichTextEditor
Add some formatted content to the composer, and do not send the message
go back to the room list
open the room with the draft
observe that the text is formatted as before.
swipe a previous message to start replying to it
observe that the formatting is not lost when doing that
Disable the RichTextEditor
observe that draft feature works like before (so no regression)
As a limitation, a draft saved with the RTE enabled can be restored a bit wildly once the RTE has been disabled. But I think this is an acceptable limitation. We may want to clear all the drafts when toggling the RTE, but user data will be lost.
Tested devices
Checklist