Skip to content

Commit

Permalink
Merge pull request #29448 from Krishna2323/krishna2323/issue/29128
Browse files Browse the repository at this point in the history
fix: Cursor freeze on paste emoji in edit message
  • Loading branch information
Beamanator authored Oct 16, 2023
2 parents f6aa21a + ac2c045 commit 895496c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,16 @@ function ReportActionItemMessageEdit(props) {
}
}
emojisPresentBefore.current = emojis;
setDraft((prevDraft) => {
if (newDraftInput !== newDraft) {
const remainder = ComposerUtils.getCommonSuffixLength(prevDraft, newDraft);
setSelection({
start: newDraft.length - remainder,
end: newDraft.length - remainder,
});
}
return newDraft;
});

setDraft(newDraft);

if (newDraftInput !== newDraft) {
const remainder = ComposerUtils.getCommonSuffixLength(newDraftInput, newDraft);
setSelection({
start: newDraft.length - remainder,
end: newDraft.length - remainder,
});
}

// This component is rendered only when draft is set to a non-empty string. In order to prevent component
// unmount when user deletes content of textarea, we set previous message instead of empty string.
Expand Down

0 comments on commit 895496c

Please sign in to comment.