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

Commit

Permalink
Fix autoreplacement of ascii emoji
Browse files Browse the repository at this point in the history
More slate API updates in code paths I didn't test

Fixes element-hq/element-web#7509
  • Loading branch information
dbkr committed Oct 26, 2018
1 parent 6c23dc0 commit 156ffd1
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 156ffd1

Please sign in to comment.