1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-11 20:22:36 +03:00

Merge pull request #2258 from matrix-org/dbkr/fix_ascii_smiley_emojification_2

Fix autoreplacement of ascii emoji
This commit is contained in:
David Baker
2018-10-29 13:57:09 +00:00
committed by GitHub

View File

@@ -544,7 +544,7 @@ export default class MessageComposerInput extends React.Component {
if (editorState.startText !== null) { if (editorState.startText !== null) {
const text = editorState.startText.text; const text = editorState.startText.text;
const currentStartOffset = editorState.startOffset; const currentStartOffset = editorState.selection.start.offset;
// Automatic replacement of plaintext emoji to Unicode emoji // Automatic replacement of plaintext emoji to Unicode emoji
if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) { if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) {
@@ -558,11 +558,11 @@ export default class MessageComposerInput extends React.Component {
const range = Range.create({ const range = Range.create({
anchor: { anchor: {
key: editorState.selection.startKey, key: editorState.startText.key,
offset: currentStartOffset - emojiMatch[1].length - 1, offset: currentStartOffset - emojiMatch[1].length - 1,
}, },
focus: { focus: {
key: editorState.selection.startKey, key: editorState.startText.key,
offset: currentStartOffset - 1, offset: currentStartOffset - 1,
}, },
}); });