Merge pull request #3884 from matrix-org/t3chguy/emoji_space_complete

Fix emoticon space completion for upper case emoticons like :D xD
This commit is contained in:
Michael Telatynski 2020-01-21 11:01:40 +00:00 committed by GitHub
commit adec308529
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,8 +107,9 @@ export default class BasicMessageEditor extends React.Component {
}); });
const emoticonMatch = REGEX_EMOTICON_WHITESPACE.exec(range.text); const emoticonMatch = REGEX_EMOTICON_WHITESPACE.exec(range.text);
if (emoticonMatch) { if (emoticonMatch) {
const query = emoticonMatch[1].toLowerCase().replace("-", ""); const query = emoticonMatch[1].replace("-", "");
const data = EMOTICON_TO_EMOJI.get(query); // try both exact match and lower-case, this means that xd won't match xD but :P will match :p
const data = EMOTICON_TO_EMOJI.get(query) || EMOTICON_TO_EMOJI.get(query.toLowerCase());
if (data) { if (data) {
const {partCreator} = model; const {partCreator} = model;