-
Notifications
You must be signed in to change notification settings - Fork 63
fix(iOS, Android): list styling #738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hejsztynx
wants to merge
22
commits into
main
Choose a base branch
from
@ksienkiewicz/fix-list-styling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
510d308
fix(ios): bullet render in unordered lists
hejsztynx b05bd53
feat(ios): dynamic ol margins
hejsztynx 1493c35
feat(android): dynamic ordered list margin
hejsztynx 999f54c
fix(ios): ordered lists recalculation on edit
hejsztynx edf431c
fix(android): ol margins compute at setValue
hejsztynx 478de71
fix(android): parse original marginLeft values
hejsztynx 4d3ec61
feat: dynamic ol markers mobile e2e tests
hejsztynx b4b98cf
chore: update e2e tests screenshot baselines
hejsztynx 84963b1
chore: screenshot baseline update
hejsztynx 540b211
fix(ios): ol indent resolution when applying typing attributes
hejsztynx 07f3960
test: update e2e baseline screenshots
hejsztynx ab42817
test: update e2e baseline screenshots
hejsztynx c5008f0
fix(android): true typeface on ol margin calculation
hejsztynx 35f2ca3
fix(ios): nil pointer handling
hejsztynx af7834f
refactor(android): ol index update and margin update logic separation
hejsztynx 3e28bba
feat(android): ordered list relayout on margin change optimization
hejsztynx c9ed47f
fix(android): distinct list detection edge case
hejsztynx 3ce8b5d
Merge branch 'main' into @ksienkiewicz/fix-list-styling
hejsztynx 05079bb
Merge branch 'main' into @ksienkiewicz/fix-list-styling
hejsztynx af516e3
Merge branch 'main' into @ksienkiewicz/fix-list-styling
hejsztynx 64d4ada
docs: update docs
hejsztynx 7e781a5
Revert "docs: update docs"
hejsztynx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| appId: swmansion.enriched.example | ||
| --- | ||
| # Validates that ordered list margins dynamically adjust when transitioning | ||
| # between single-digit (9) and double-digit (10) indexes. | ||
| - launchApp | ||
|
|
||
| - tapOn: | ||
| id: 'toggle-screen-button' | ||
|
|
||
| - runFlow: | ||
| file: '../subflows/set_editor_value.yaml' | ||
| env: | ||
| VALUE: > | ||
| <html> | ||
| <ol> | ||
| <li>A</li> | ||
| <li>B</li> | ||
| <li>C</li> | ||
| <li>D</li> | ||
| <li>E</li> | ||
| <li>F</li> | ||
| <li>G</li> | ||
| <li>H</li> | ||
| <li>I</li> | ||
| </ol> | ||
| </html> | ||
|
|
||
| - tapOn: | ||
| id: 'size-max-button' | ||
|
|
||
| - runFlow: | ||
| file: '../subflows/capture_or_assert_screenshot.yaml' | ||
| env: | ||
| SCREENSHOT_NAME: 'dynamic_ol_markers_before' | ||
|
|
||
| - tapOn: | ||
| id: "editor-input" | ||
| point: "50%, 95%" | ||
| - pressKey: Enter | ||
| - inputText: "J" | ||
|
|
||
| - runFlow: | ||
| file: '../subflows/capture_or_assert_screenshot.yaml' | ||
| env: | ||
| SCREENSHOT_NAME: 'dynamic_ol_markers_after' | ||
|
|
||
| - tapOn: | ||
| id: "editor-input" | ||
| point: "50%, 95%" | ||
| - pressKey: Backspace | ||
| - pressKey: Backspace | ||
|
|
||
| - runFlow: | ||
| file: '../subflows/capture_or_assert_screenshot.yaml' | ||
| env: | ||
| SCREENSHOT_NAME: 'dynamic_ol_markers_revert' |
Binary file added
BIN
+18.1 KB
.maestro/enrichedInput/screenshots/android/dynamic_ol_markers_after.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.1 KB
.maestro/enrichedInput/screenshots/android/dynamic_ol_markers_before.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.4 KB
.maestro/enrichedInput/screenshots/android/dynamic_ol_markers_revert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1 Byte
(100%)
.maestro/enrichedInput/screenshots/android/empty_element_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/empty_lists_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2 Bytes
(100%)
...ichedInput/screenshots/android/extending_paragraph_style_on_paste_after_cut.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/image_inside_list_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-68 Bytes
(99%)
.maestro/enrichedInput/screenshots/android/list_newline_insertion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+818 Bytes
(100%)
.../enrichedInput/screenshots/android/mention_popup_closing_on_cursor_travel_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+810 Bytes
(100%)
.../enrichedInput/screenshots/android/mention_popup_closing_on_cursor_travel_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+814 Bytes
(100%)
.../enrichedInput/screenshots/android/mention_popup_closing_on_cursor_travel_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-48 Bytes
(99%)
...put/screenshots/android/ordered_list_renumbering_after_deleting_second_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-92 Bytes
(98%)
...put/screenshots/android/ordered_list_renumbering_after_emptying_second_line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-30 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/paragraph_styles_alignment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-25 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/paragraph_styles_lists.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-46 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/paragraph_styles_no_crash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+28 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/scrolling_paragraph_styles_bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+0 Bytes
(100%)
.maestro/enrichedInput/screenshots/android/scrolling_paragraph_styles_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+51 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/empty_element_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+24 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/empty_lists_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/image_inside_list_parsing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-55 Bytes
(99%)
.maestro/enrichedInput/screenshots/ios/list_newline_insertion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-48 Bytes
(99%)
...edInput/screenshots/ios/ordered_list_renumbering_after_deleting_second_line.png
Oops, something went wrong.
Binary file modified
BIN
-104 Bytes
(98%)
...edInput/screenshots/ios/ordered_list_renumbering_after_emptying_second_line.png
Oops, something went wrong.
Binary file modified
BIN
-7 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/paragraph_styles_alignment.png
Oops, something went wrong.
Binary file modified
BIN
+108 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/paragraph_styles_lists.png
Oops, something went wrong.
Binary file modified
BIN
-29 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/paragraph_styles_no_crash.png
Oops, something went wrong.
Binary file modified
BIN
+25 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/scrolling_paragraph_styles_bottom.png
Oops, something went wrong.
Binary file modified
BIN
+0 Bytes
(100%)
.maestro/enrichedInput/screenshots/ios/scrolling_paragraph_styles_top.png
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| appId: swmansion.enriched.example | ||
| --- | ||
| # Validates that ordered list margins dynamically adjust when transitioning | ||
| # between single-digit (9) and double-digit (10) indexes. | ||
| - launchApp | ||
|
|
||
| - tapOn: | ||
| id: 'toggle-screen-button' | ||
|
|
||
| - tapOn: | ||
| id: 'toggle-enriched-text-screen-button' | ||
|
|
||
| - runFlow: | ||
| file: '../subflows/set_enriched_text_value.yaml' | ||
| env: | ||
| VALUE: > | ||
| <html> | ||
| <ol> | ||
| <li>A</li> | ||
| <li>B</li> | ||
| <li>C</li> | ||
| </ol> | ||
| <br> | ||
| <ol> | ||
| <li>A</li> | ||
| <li>B</li> | ||
| <li>C</li> | ||
| <li>D</li> | ||
| <li>E</li> | ||
| <li>F</li> | ||
| <li>G</li> | ||
| <li>H</li> | ||
| <li>I</li> | ||
| <li>J</li> | ||
| </ol> | ||
| </html> | ||
|
|
||
| - runFlow: | ||
| file: '../subflows/capture_or_assert_screenshot.yaml' | ||
| env: | ||
| SCREENSHOT_NAME: 'dynamic_ol_markers' |
Binary file modified
BIN
+6 Bytes
(100%)
.maestro/enrichedText/screenshots/android/alignment_visual.png
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+49 Bytes
(100%)
.maestro/enrichedText/screenshots/android/empty_list_elements_display.png
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+422 Bytes
(100%)
.maestro/enrichedText/screenshots/android/paragraph_styles_display.png
Oops, something went wrong.
Binary file modified
BIN
+17 Bytes
(100%)
.maestro/enrichedText/screenshots/ios/alignment_visual.png
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+54 Bytes
(100%)
.maestro/enrichedText/screenshots/ios/empty_list_elements_display.png
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+8 Bytes
(100%)
.maestro/enrichedText/screenshots/ios/paragraph_styles_display.png
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
android/src/main/java/com/swmansion/enriched/common/OrderedListMargins.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package com.swmansion.enriched.common | ||
|
|
||
| import android.graphics.Paint | ||
| import android.text.Spanned | ||
| import com.swmansion.enriched.common.spans.EnrichedOrderedListSpan | ||
|
|
||
| // Recomputes the shared marker column width for every ordered-list item. | ||
| // Returns true when any item's column width changed, so callers can force a relayout. | ||
| fun updateOrderedListColumnMargins( | ||
| text: Spanned, | ||
| paint: Paint, | ||
| ): Boolean { | ||
| val spans = text.getSpans(0, text.length, EnrichedOrderedListSpan::class.java) | ||
| val sortedSpans = spans.sortedBy { text.getSpanStart(it) } | ||
|
|
||
| var changed = false | ||
| var previousIndex = 0 | ||
| var highestIndex = 0 | ||
| for (span in sortedSpans.reversed()) { | ||
| val currentIndex = span.index | ||
| if (currentIndex > previousIndex) { | ||
| highestIndex = currentIndex | ||
| } | ||
| if (span.updateColumnMargin(paint, highestIndex)) changed = true | ||
|
|
||
| previousIndex = currentIndex | ||
| } | ||
|
|
||
| return changed | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.