You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-22 04:02:40 +03:00
pull toLowerCase(...).replace(...) out of the loop
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
@@ -533,10 +533,8 @@ export default class MessageComposerInput extends React.Component {
|
|||||||
// The first matched group includes just the matched plaintext emoji
|
// The first matched group includes just the matched plaintext emoji
|
||||||
const emoticonMatch = REGEX_EMOTICON_WHITESPACE.exec(text.slice(0, currentStartOffset));
|
const emoticonMatch = REGEX_EMOTICON_WHITESPACE.exec(text.slice(0, currentStartOffset));
|
||||||
if (emoticonMatch) {
|
if (emoticonMatch) {
|
||||||
const data = EMOJIBASE.find(e => {
|
const query = emoticonMatch[1].toLowerCase().replace("-", "");
|
||||||
if (!e.emoticon) return false;
|
const data = EMOJIBASE.find(e => e.emoticon ? e.emoticon.toLowerCase() === query : false);
|
||||||
return e.emoticon.toLowerCase() === emoticonMatch[1].toLowerCase().replace("-", "");
|
|
||||||
});
|
|
||||||
|
|
||||||
// only perform replacement if we found a match, otherwise we would be not letting user type
|
// only perform replacement if we found a match, otherwise we would be not letting user type
|
||||||
if (data) {
|
if (data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user