From a0fee1f22f6eaf7ae4db2b88d69ad950738091f8 Mon Sep 17 00:00:00 2001 From: Horacio Herrera Date: Mon, 4 Mar 2024 19:36:50 +0100 Subject: [PATCH] fix(mentions): prevent making mentions stay open on other interactions --- frontend/packages/editor/src/autocomplete.tsx | 72 ++++++++++++------- 1 file changed, 46 insertions(+), 26 deletions(-) diff --git a/frontend/packages/editor/src/autocomplete.tsx b/frontend/packages/editor/src/autocomplete.tsx index af1a1c8ff..f6f40d840 100644 --- a/frontend/packages/editor/src/autocomplete.tsx +++ b/frontend/packages/editor/src/autocomplete.tsx @@ -298,37 +298,57 @@ function AutocompletePopupInner( return (
- {/*
Query: "{text}"
*/} - {suggestions.length === 0 &&
No Results
} - {suggestions.map((suggestion, i) => { - return ( - { - // setIndex(i) - }} - onPress={() => { - onCreate(suggestion, range) - onClose() - }} - /> - ) - })} +
{ + e.preventDefault() + e.stopPropagation() + onClose() + }} + /> +
+ {/*
Query: "{text}"
*/} + {suggestions.length === 0 &&
No Results
} + {suggestions.map((suggestion, i) => { + return ( + { + // setIndex(i) + }} + onPress={() => { + onCreate(suggestion, range) + onClose() + }} + /> + ) + })} +
) }