Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2258 from matrix-org/dbkr/fix_ascii_smiley_emojif…
Browse files Browse the repository at this point in the history
…ication_2

Fix autoreplacement of ascii emoji
  • Loading branch information
dbkr authored Oct 29, 2018
2 parents 43702a4 + 9933a3c commit 69a8b3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/views/rooms/MessageComposerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ export default class MessageComposerInput extends React.Component {

if (editorState.startText !== null) {
const text = editorState.startText.text;
const currentStartOffset = editorState.startOffset;
const currentStartOffset = editorState.selection.start.offset;

// Automatic replacement of plaintext emoji to Unicode emoji
if (SettingsStore.getValue('MessageComposerInput.autoReplaceEmoji')) {
Expand All @@ -558,11 +558,11 @@ export default class MessageComposerInput extends React.Component {

const range = Range.create({
anchor: {
key: editorState.selection.startKey,
key: editorState.startText.key,
offset: currentStartOffset - emojiMatch[1].length - 1,
},
focus: {
key: editorState.selection.startKey,
key: editorState.startText.key,
offset: currentStartOffset - 1,
},
});
Expand Down

0 comments on commit 69a8b3b

Please sign in to comment.