From 1d0a86c064968fa7b11db44e7ac3ff86e6741c24 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Thu, 19 Oct 2023 20:42:47 +0530 Subject: [PATCH] chore: only allow whitespace after valid character in super item selection --- .../useTypeaheadAllowingSpacesAndPunctuation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemSelectionPlugin/useTypeaheadAllowingSpacesAndPunctuation.tsx b/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemSelectionPlugin/useTypeaheadAllowingSpacesAndPunctuation.tsx index 8a601dcf4..2c24b6219 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemSelectionPlugin/useTypeaheadAllowingSpacesAndPunctuation.tsx +++ b/packages/web/src/javascripts/Components/SuperEditor/Plugins/ItemSelectionPlugin/useTypeaheadAllowingSpacesAndPunctuation.tsx @@ -20,7 +20,7 @@ export function useTypeaheadAllowingSpacesAndPunctuation( (text: string) => { const validChars = '[^' + trigger + ']' const TypeaheadTriggerRegex = new RegExp( - '(^|\\s|\\()(' + '[' + trigger + ']' + '((?:' + validChars + '){0,' + maxLength + '})' + ')$', + '(^|\\s|\\()(' + '[' + trigger + ']' + '(\\S(?:' + validChars + '){0,' + maxLength + '})' + ')$', ) const match = TypeaheadTriggerRegex.exec(text) if (match !== null) {