element-x-android
element-x-android copied to clipboard
Plain text editor implementation based on markdown input
Type of change
- [x] Feature
- [ ] Bugfix
- [ ] Technical
- [ ] Other :
Content
- Added
MarkdownTextInput, aTextInputcounterpart that uses a simpleEditTextunder the hood, instead of the RTE library. This will be the default editor unless the user explicitly enables rich text formatting. - Added
MarkdownTextEditorStateto act as a way to interact with theEditTextfrom Compose code. - Wrapped both
RichTextEditorStateandMarkdownTextEditorStateinto aTextEditorStatesealed interface with some helper functions. - Moved the parsing of the current editor state to send a message to
MessageComposerPresenterfrom the View, as well as adding mention spans to the plain text editor. Sadly, this means having to add aMentionSpanProviderto presenter, which makes it more difficult to test. I also had to addisTestingandshowFormattingproperties to the presenter so it can be easily tested. I'll probably iterate on this later. - Removed the 'enable rich text editor' option from advanced settings, replaced it with a build config option in
MessageComposerConfigin theappconfigmodule.
Known issues:
- Mentions can't be converted from/to plain text and rich text yet. I'll handle this in another PR.
- We probably want to keep track of whether the text formatting mode was last enabled so we can restore the text editor with that same value when navigating from one room to the other. This will also be handled in another PR.
Needs https://github.com/matrix-org/matrix-rich-text-editor/pull/978.
Motivation and context
The RTE library has been problematic for some users, most of which didn't want to use rich text at all, so enabling
Screenshots / GIFs
I made the 2 editors look exactly the same, even replaced the editor used in some previews and the golden screenshots didn't change.
Tests
Thoroughly test the plain text editor and enabling / disabling text formatting, editing messages, replying to messages, etc.
Tested devices
- [x] Physical
- [ ] Emulator
- OS version(s): 14
Checklist
- [ ] Changes have been tested on an Android device or Android emulator with API 23
- [x] UI change has been tested on both light and dark themes
- [ ] Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
- [x] Pull request is based on the develop branch
- [x] Pull request includes a new file under ./changelog.d. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#changelog
- [x] Pull request includes screenshots or videos if containing UI changes
- [ ] Pull request includes a sign off
- [x] You've made a self review of your PR
:iphone: Scan the QR code below to install the build (arm64 only) for this PR.
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/3dEnhM
Codecov Report
Attention: Patch coverage is 82.59861% with 75 lines in your changes are missing coverage. Please review.
Project coverage is 74.34%. Comparing base (
cddb02f) to head (ca4691e).
Additional details and impacted files
@@ Coverage Diff @@
## develop #2840 +/- ##
===========================================
+ Coverage 74.30% 74.34% +0.03%
===========================================
Files 1530 1536 +6
Lines 36526 36734 +208
Branches 7055 7123 +68
===========================================
+ Hits 27142 27309 +167
- Misses 5698 5700 +2
- Partials 3686 3725 +39
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
| Warnings | |
|---|---|
| :warning: |
gradle/libs.versions.toml#L6 - A newer version of com.android.tools.build:gradle than 8.4.0 is available: 8.4.1 |
| :warning: |
gradle/libs.versions.toml#L12 - A newer version of androidx.core:core-ktx than 1.13.0 is available: 1.13.1 |
| :warning: |
gradle/libs.versions.toml#L18 - A newer version of androidx.datastore:datastore-preferences than 1.0.0 is available: 1.1.1 |
| :warning: |
gradle/libs.versions.toml#L21 - A newer version of androidx.lifecycle:lifecycle-runtime-ktx than 2.7.0 is available: 2.8.0 |
| :warning: |
gradle/libs.versions.toml#L22 - A newer version of androidx.activity:activity-compose than 1.8.2 is available: 1.9.0 |
| Messages | |
|---|---|
| :book: |
gradle/libs.versions.toml#L136 - There are multiple dependencies junit:junit but with different version |
| :book: |
gradle/libs.versions.toml#L138 - There are multiple dependencies androidx.test.ext:junit but with different version |
| :book: |
gradle/libs.versions.toml#L207 - There are multiple dependencies junit:junit but with different version |
| :book: |
gradle/libs.versions.toml#L208 - There are multiple dependencies androidx.test.ext:junit but with different version |
Generated by :no_entry_sign: dangerJS against ca4691e8056ec15e0d50b58ff2710ea40957ae51
@bmarty your issue above should be fixed in https://github.com/element-hq/element-x-android/pull/2840/commits/b73a63b95595f3db486c38111595c81bcd30b5a1.
I also added changes for your other comments.
Nice! I'll release a RTE version compatible with these changes and merge the PR.
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
The Maestro job got stuck after finishing so it was in a limbo. I just force merged.