Skip to content

Commit

Permalink
Disable mention suggestion box if selecting text
Browse files Browse the repository at this point in the history
  • Loading branch information
aldo-expensify committed Jun 20, 2024
1 parent 896c14c commit 2e184c6
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ function SuggestionMention(
);

const calculateMentionSuggestion = useCallback(
(selectionEnd?: number) => {
if (!selectionEnd || shouldBlockCalc.current || selectionEnd < 1 || !isComposerFocused) {
(selectionStart?: number, selectionEnd?: number) => {
if (selectionEnd !== selectionStart || !selectionEnd || shouldBlockCalc.current || selectionEnd < 1 || !isComposerFocused) {
shouldBlockCalc.current = false;
resetSuggestions();
return;
Expand Down Expand Up @@ -384,7 +384,7 @@ function SuggestionMention(
);

useEffect(() => {
calculateMentionSuggestion(selection.end);
calculateMentionSuggestion(selection.start, selection.end);
}, [selection, calculateMentionSuggestion]);

useEffect(() => {
Expand Down

0 comments on commit 2e184c6

Please sign in to comment.