element-android icon indicating copy to clipboard operation
element-android copied to clipboard

Fix Rich Text Editor issues: save formatted text in draft and keep formatting when switching between modes

Open bmarty opened this issue 1 year ago • 3 comments

Type of change

  • [ ] Feature
  • [x] Bugfix
  • [ ] Technical
  • [ ] Other :

Content

  • First commit: When using the RichTextEditor, store the formatted text into the Draft, to be able to restore it correctly.
  • Second commit: Keep the formatted text into memory to be able to keep it when switching between composer modes.

Motivation and context

Avoid formatting loses.

Closes #7466

Screenshots / GIFs

FormattedDraft

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

  • [ ] Physical
  • [x] Emulator
  • OS version(s):

Checklist

  • [ ] Changes has been tested on an Android device or Android emulator with API 21
  • [ ] UI change has been tested on both light and dark themes
  • [ ] Accessibility has been taken into account. See https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#accessibility
  • [ ] Pull request is based on the develop branch
  • [ ] Pull request includes a new file under ./changelog.d. See https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#changelog
  • [ ] Pull request includes screenshots or videos if containing UI changes
  • [ ] Pull request includes a sign off
  • [ ] You've made a self review of your PR
  • [ ] If you have modified the screen flow, or added new screens to the application, you have updated the test UiAllScreensSanityTest.allScreensTest()

bmarty avatar Jan 31 '24 17:01 bmarty

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).

ganfra avatar Feb 06 '24 15:02 ganfra

There is some scenarios where the send button never shows up

I cannot repro the issue of send button not visible. Can you be more precise about the scenario to repro please?

bmarty avatar Feb 07 '24 15:02 bmarty

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).

@ganfra what is the scenario where the send button disappears? about the blinking, I think this was fixed by https://github.com/element-hq/element-android/pull/8770. What is blocking this PR?

giomfo avatar Apr 12 '24 13:04 giomfo