From 2aa8ad8ec2865f1f527ad9867409f9a277f4d8aa Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 19 Feb 2024 15:48:26 +0700 Subject: [PATCH] fix: The list of users in mentions does not disappear when using the Shift+Enter --- src/pages/home/report/ReportActionCompose/SuggestionMention.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/SuggestionMention.js b/src/pages/home/report/ReportActionCompose/SuggestionMention.js index 152ce54d5481..6bdea2cb4a27 100644 --- a/src/pages/home/report/ReportActionCompose/SuggestionMention.js +++ b/src/pages/home/report/ReportActionCompose/SuggestionMention.js @@ -203,7 +203,8 @@ function SuggestionMention({ suggestionEndIndex = indexOfFirstSpecialCharOrEmojiAfterTheCursor + selectionEnd; } - const leftString = value.substring(0, suggestionEndIndex); + const newLineIndex = value.lastIndexOf('\n', selectionEnd - 1); + const leftString = value.substring(newLineIndex + 1, suggestionEndIndex); const words = leftString.split(CONST.REGEX.SPACE_OR_EMOJI); const lastWord = _.last(words); const secondToLastWord = words[words.length - 3];