mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
Merge pull request #1261 from matrix-org/luke/fix-agressive-emoji-auto-replace
Only auto-replace emoji following ^ or \s
This commit is contained in:
commit
7fcb8c5ff0
1 changed files with 2 additions and 2 deletions
|
@ -50,7 +50,7 @@ const REGEX_MATRIXTO_MARKDOWN_GLOBAL = new RegExp(MATRIXTO_MD_LINK_PATTERN, 'g')
|
||||||
import {asciiRegexp, shortnameToUnicode, emojioneList, asciiList, mapUnicodeToShort} from 'emojione';
|
import {asciiRegexp, shortnameToUnicode, emojioneList, asciiList, mapUnicodeToShort} from 'emojione';
|
||||||
const EMOJI_SHORTNAMES = Object.keys(emojioneList);
|
const EMOJI_SHORTNAMES = Object.keys(emojioneList);
|
||||||
const EMOJI_UNICODE_TO_SHORTNAME = mapUnicodeToShort();
|
const EMOJI_UNICODE_TO_SHORTNAME = mapUnicodeToShort();
|
||||||
const REGEX_EMOJI_WHITESPACE = new RegExp('(' + asciiRegexp + ')\\s$');
|
const REGEX_EMOJI_WHITESPACE = new RegExp('(?:^|\\s)(' + asciiRegexp + ')\\s$');
|
||||||
|
|
||||||
const TYPING_USER_TIMEOUT = 10000, TYPING_SERVER_TIMEOUT = 30000;
|
const TYPING_USER_TIMEOUT = 10000, TYPING_SERVER_TIMEOUT = 30000;
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
const newContentState = Modifier.replaceText(
|
const newContentState = Modifier.replaceText(
|
||||||
editorState.getCurrentContent(),
|
editorState.getCurrentContent(),
|
||||||
currentSelection.merge({
|
currentSelection.merge({
|
||||||
anchorOffset: currentStartOffset - emojiMatch[0].length,
|
anchorOffset: currentStartOffset - emojiMatch[1].length - 1,
|
||||||
focusOffset: currentStartOffset,
|
focusOffset: currentStartOffset,
|
||||||
}),
|
}),
|
||||||
unicodeEmoji,
|
unicodeEmoji,
|
||||||
|
|
Loading…
Reference in a new issue