Only pop emoji autocomplete for strict set of characters
This commit is contained in:
parent
b19659f5ac
commit
0beb1416d1
1 changed files with 2 additions and 1 deletions
|
@ -30,6 +30,7 @@ import {
|
|||
import { LocalizerType } from '../types/Util';
|
||||
|
||||
const colonsRegex = /(?:^|\s):[a-z0-9-_+]+:?/gi;
|
||||
const triggerEmojiRegex = /^(?:[-+]\d|[a-z]{2})/i;
|
||||
|
||||
export type Props = {
|
||||
readonly i18n: LocalizerType;
|
||||
|
@ -276,7 +277,7 @@ export const CompositionInput = ({
|
|||
} else {
|
||||
resetEmojiResults();
|
||||
}
|
||||
} else if (newSearchText.length >= 2 && focusRef.current) {
|
||||
} else if (triggerEmojiRegex.test(newSearchText) && focusRef.current) {
|
||||
setEmojiResults(search(newSearchText, 10));
|
||||
setSearchText(newSearchText);
|
||||
setEmojiResultsIndex(0);
|
||||
|
|
Loading…
Add table
Reference in a new issue