mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Remove emojification on message send
This commit is contained in:
@@ -20,12 +20,7 @@ import classNames from 'classnames';
|
||||
import emojiRegex from 'emoji-regex';
|
||||
import { Emoji } from './emoji/Emoji';
|
||||
import { EmojiPickDataType } from './emoji/EmojiPicker';
|
||||
import {
|
||||
convertShortName,
|
||||
EmojiData,
|
||||
replaceColons,
|
||||
search,
|
||||
} from './emoji/lib';
|
||||
import { convertShortName, EmojiData, search } from './emoji/lib';
|
||||
import { LocalizerType } from '../types/Util';
|
||||
import { createRefMerger } from './_util';
|
||||
|
||||
@@ -395,9 +390,10 @@ export const CompositionInput = ({
|
||||
|
||||
const submit = React.useCallback(() => {
|
||||
const { current: state } = editorStateRef;
|
||||
const text = state.getCurrentContent().getPlainText();
|
||||
const emojidText = replaceColons(text);
|
||||
const trimmedText = emojidText.trim();
|
||||
const trimmedText = state
|
||||
.getCurrentContent()
|
||||
.getPlainText()
|
||||
.trim();
|
||||
onSubmit(trimmedText);
|
||||
}, [editorStateRef, onSubmit]);
|
||||
|
||||
|
||||
@@ -274,22 +274,6 @@ export function emojiToImage(emoji: string): string | undefined {
|
||||
return imageByEmoji[emoji];
|
||||
}
|
||||
|
||||
export function replaceColons(str: string) {
|
||||
return str.replace(/:[a-z0-9-_+]+:(?::skin-tone-[1-5]:)?/gi, m => {
|
||||
const [shortName = '', skinTone = '0'] = m
|
||||
.replace('skin-tone-', '')
|
||||
.toLowerCase()
|
||||
.split(':')
|
||||
.filter(Boolean);
|
||||
|
||||
if (shortName && isShortName(shortName)) {
|
||||
return convertShortName(shortName, parseInt(skinTone, 10));
|
||||
}
|
||||
|
||||
return m;
|
||||
});
|
||||
}
|
||||
|
||||
function getCountOfAllMatches(str: string, regex: RegExp) {
|
||||
let match = regex.exec(str);
|
||||
let count = 0;
|
||||
|
||||
Reference in New Issue
Block a user