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

Commit 9933a3c

Browse files
committed
Fix autoreplacement of ascii emoji
More slate API updates in code paths I didn't test Fixes element-hq/element-web#7509
1 parent 43702a4 commit 9933a3c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/views/rooms/MessageComposerInput.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export default class MessageComposerInput extends React.Component {
544544

545545
if (editorState.startText !== null) {
546546
const text = editorState.startText.text;
547-
const currentStartOffset = editorState.startOffset;
547+
const currentStartOffset = editorState.selection.start.offset;
548548

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

559559
const range = Range.create({
560560
anchor: {
561-
key: editorState.selection.startKey,
561+
key: editorState.startText.key,
562562
offset: currentStartOffset - emojiMatch[1].length - 1,
563563
},
564564
focus: {
565-
key: editorState.selection.startKey,
565+
key: editorState.startText.key,
566566
offset: currentStartOffset - 1,
567567
},
568568
});

0 commit comments

Comments
 (0)