[WIP] fix: preserve Markdown formatting in long messages - #100421
Draft
Uzaifm127 wants to merge 4 commits into
Draft
[WIP] fix: preserve Markdown formatting in long messages#100421Uzaifm127 wants to merge 4 commits into
Uzaifm127 wants to merge 4 commits into
Conversation
Contributor
|
|
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Pass CONST.MAX_MARKUP_LENGTH to all emoji-related parseExpensiMark calls
Add regression coverage for emoji reversion, shortcode replacement, and suggestion detection at the 10,000-character markup limit.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation of Change
ExpensiMark.replace()was optimized to avoid running the autolink, bold, and strikethrough regexes over the complete text on every change. The scanner first finds small possible URL and Markdown candidates, then the existing ExpensiMark regexes validate and replace only those candidates.This keeps the existing parsing behavior while reducing the work required for long composer messages.
react-native-live-markdownnow allowsparseExpensiMarkfunction callers to provide the maximum length passed toparseExpensiMark.App uses
CONST.MAX_MARKUP_LENGTH, which is10,000characters. This PR passes that value to all the locations in the App that useparseExpensiMarkfor composer Markdown parsing and selected-text formatting, instead of using the library default of4,000.Fixed Issues
$ #95210
PROPOSAL: #95210 (comment)
Tests
Note
The complete composer text, including the Markdown added during testing, must contain more than 4,000 and fewer than 10,000 characters.
Test 1 (All platforms)
Note
Android native has a separate known typing-delay issue with long text, which will be handled in a follow-up. Do not fail this PR because of that delay. For Android native, verify that Markdown remains preserved after 4,000 characters. On the other platforms, also verify that typing remains responsive.
Test 2 (Web)
bold, without selecting the stars (*).Cmd+Bon macOS orCtrl+Bon Windowsitalic, without underscores.Cmd+IorCtrl+I.boldon pressingcmd/ctrl + band becomesitalicon pressingcmd/ctrl + i.Test 3 (All platforms)
`😄`without selecting any existing text.`:smile:`.:smile: and `:wave:`without selecting any existing text.:smile:outside the backticks becomes 😄.:wave:inside the backticks remains unchanged.Test 4 (All platforms)
:smi, for example:`:smi`.:smioutside the backticks.Offline tests
Same as Test
QA Steps
Same as Test
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android-native.mov
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios-native.mp4
iOS: mWeb Safari
ios-safari.mp4
MacOS: Chrome / Safari
macOS.web.mp4