Skip to content

Commit

Permalink
fix: Cursor freeze on paste emoji in edit message
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Gupta <belivethatkg@gmail.com>
  • Loading branch information
Krishna2323 committed Oct 12, 2023
1 parent d8befee commit ac2c045
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 @@ -211,16 +211,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 ac2c045

Please sign in to comment.