Match by emoji ascii regex first before shorthand
Plaintext emojis that start with ":" will also match against the shorthand regex but the match won't include the important part of the plaintext emoji. This means some emoji like ":)" won't be matched. To fix this, put the ascii emoji regex first so that the match will be plaintext or otherwise it will fall through to the shorthand match (if there is one). Fixes https://github.com/vector-im/riot-web/issues/4467
This commit is contained in:
parent
0b46184a21
commit
b315ed630e
1 changed files with 1 additions and 1 deletions
|
@ -41,7 +41,7 @@ const CATEGORY_ORDER = [
|
||||||
];
|
];
|
||||||
|
|
||||||
// Match for ":wink:" or ascii-style ";-)" provided by emojione
|
// Match for ":wink:" or ascii-style ";-)" provided by emojione
|
||||||
const EMOJI_REGEX = new RegExp('(:\\w*:?|' + asciiRegexp + ')', 'g');
|
const EMOJI_REGEX = new RegExp('(' + asciiRegexp + '|:\\w*:?)', 'g');
|
||||||
const EMOJI_SHORTNAMES = Object.keys(EmojiData).map((key) => EmojiData[key]).sort(
|
const EMOJI_SHORTNAMES = Object.keys(EmojiData).map((key) => EmojiData[key]).sort(
|
||||||
(a, b) => {
|
(a, b) => {
|
||||||
if (a.category === b.category) {
|
if (a.category === b.category) {
|
||||||
|
|
Loading…
Reference in a new issue