mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
Merge pull request #1151 from Mm2PL/feature/emoji_rfc
Add the workaround for combined emoji described in #1147.
This commit is contained in:
commit
feae6bcb89
3 changed files with 9 additions and 3 deletions
|
@ -47,6 +47,8 @@ export const SKIN_TONES = {
|
|||
4: '1f3fe',
|
||||
5: '1f3ff'
|
||||
};
|
||||
export const JOINER_REPLACEMENT = /(?<!\u{E0002})\u{E0002}/gu;
|
||||
export const EMOJI_JOINER = '\u{E0002}';
|
||||
|
||||
export const IMAGE_PATHS = {
|
||||
google: 'noto',
|
||||
|
|
|
@ -8,7 +8,7 @@ import {sanitize, createElement} from 'utilities/dom';
|
|||
import {has, getTwitchEmoteURL, split_chars, getTwitchEmoteSrcSet} from 'utilities/object';
|
||||
|
||||
import {EmoteTypes, REPLACEMENT_BASE, REPLACEMENTS} from 'utilities/constants';
|
||||
import {CATEGORIES} from './emoji';
|
||||
import {CATEGORIES, JOINER_REPLACEMENT} from './emoji';
|
||||
|
||||
|
||||
const EMOTE_CLASS = 'chat-image chat-line__message--emote',
|
||||
|
@ -1547,7 +1547,7 @@ export const Emoji = {
|
|||
continue;
|
||||
}
|
||||
|
||||
const text = token.text;
|
||||
const text = token.text.replace(JOINER_REPLACEMENT, "\u200d");
|
||||
|
||||
splitter.lastIndex = 0;
|
||||
let idx = 0, match;
|
||||
|
|
|
@ -12,6 +12,8 @@ import { TWITCH_POINTS_SETS, TWITCH_GLOBAL_SETS, TWITCH_PRIME_SETS, KNOWN_CODES,
|
|||
|
||||
import Twilight from 'site';
|
||||
|
||||
import {EMOJI_JOINER} from 'src/modules/chat/emoji';
|
||||
|
||||
// Prefer using these statically-allocated collators to String.localeCompare
|
||||
const locale = Intl.Collator();
|
||||
const localeCaseInsensitive = Intl.Collator(undefined, {sensitivity: 'accent'});
|
||||
|
@ -55,7 +57,6 @@ function getNodeOffset(nodes, path) {
|
|||
return offset;
|
||||
}
|
||||
|
||||
|
||||
export default class Input extends Module {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
@ -508,6 +509,9 @@ export default class Input extends Module {
|
|||
t.log.error(err);
|
||||
}
|
||||
|
||||
// replace ZERO WIDTH JOINER with custom joiner so combined emoji work
|
||||
inst.autocompleteInputRef.setValue(inst.chatInputRef.value.replace('\u{200d}', EMOJI_JOINER));
|
||||
|
||||
originalOnMessageSend.call(this, event);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue