Skip to content

Commit

Permalink
Merge pull request #44168 from nkdengineer/fix/44085
Browse files Browse the repository at this point in the history
[CP Staging]fix: crash app when entering mention.
  • Loading branch information
rlinoz authored Jun 21, 2024
2 parents 9817d3c + dcb2972 commit 0d147a4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions patches/@expensify+react-native-live-markdown+0.1.85.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js
index e975fb2..6a4b510 100644
--- a/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js
+++ b/node_modules/@expensify/react-native-live-markdown/lib/module/web/cursorUtils.js
@@ -53,7 +53,7 @@ function setCursorPosition(target, start, end = null) {
// 3. Caret at the end of whole input, when pressing enter
// 4. All other placements
if (prevChar === '\n' && prevTextLength !== undefined && prevTextLength < textCharacters.length) {
- if (nextChar !== '\n') {
+ if (nextChar !== '\n' && i !== n - 1 && nextChar) {
range.setStart(textNodes[i + 1], 0);
} else if (i !== textNodes.length - 1) {
range.setStart(textNodes[i], 1);

0 comments on commit 0d147a4

Please sign in to comment.