-
Notifications
You must be signed in to change notification settings - Fork 87
Fix cursor position problems on mWeb #700
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
base: main
Are you sure you want to change the base?
Fix cursor position problems on mWeb #700
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix works great!
Added just 2 improvement suggestions
function mergeLinesWithMultilineTags(lines: Paragraph[], ranges: MarkdownRange[]) { | ||
/** | ||
* For singleline markdown types, the function splits markdown ranges that spread beyond the line length into separate lines. | ||
* For multiline markdown types (like `pre`), it merges them and corresponsing text into one line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* For multiline markdown types (like `pre`), it merges them and corresponsing text into one line. | |
* For multiline markdown types (like `pre`), it merges them and corresponding text into one line. |
* For singleline markdown types, the function splits markdown ranges that spread beyond the line length into separate lines. | ||
* For multiline markdown types (like `pre`), it merges them and corresponsing text into one line. | ||
*/ | ||
function normalizeLines(lines: Paragraph[], ranges: MarkdownRange[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function has grown quite a bit :(
Maybe it can be refactored, so each case is a named function?
* For singleline markdown types, the function splits markdown ranges that spread beyond the line length into separate lines. | ||
* For multiline markdown types (like `pre`), it merges them and corresponsing text into one line. | ||
*/ | ||
function normalizeLines(lines: Paragraph[], ranges: MarkdownRange[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love some tests for this as well :D
Details
This PR fixes issues with invalid cursor position on Android mWeb in cases when multiline markdown syntax is being removed. The problem lay in the current Live Markdown Input structure, where after splitting text into lines, we were merging all lines that contained ranges that go beyond the line length into one line. Now, if the markdown type isn't marked as a multiline type (the one that can have
<br>
tags in it), we are corresponding ranges into separate lines.chrome.mWeb.mov
Related Issues
Expensify/App#57024
Manual Tests
Linked PRs