chore: only allow whitespace after valid character in super item selection

This commit is contained in:
Aman Harwara
2023-10-19 20:42:47 +05:30
parent a62ffc6cf9
commit 1d0a86c064

View File

@@ -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) {