mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Merge pull request #2431 from Bilb/fix-double-clcik-emoji-picker-reply-msg
fix: make sure a double click on the picker does not trigger reply msg
This commit is contained in:
commit
506eb20faf
1 changed files with 14 additions and 11 deletions
|
@ -30,6 +30,7 @@ type Props = {
|
|||
dataTestId?: string;
|
||||
enableReactions: boolean;
|
||||
};
|
||||
// tslint:disable: use-simple-attributes
|
||||
|
||||
const StyledMessageContentContainer = styled.div<{ direction: 'left' | 'right' }>`
|
||||
display: flex;
|
||||
|
@ -66,17 +67,19 @@ export const MessageContentWithStatuses = (props: Props) => {
|
|||
const currentSelection = window.getSelection();
|
||||
const currentSelectionString = currentSelection?.toString() || undefined;
|
||||
|
||||
// if multiple word are selected, consider that this double click was actually NOT used to reply to
|
||||
// but to select
|
||||
if (
|
||||
!currentSelectionString ||
|
||||
currentSelectionString.length === 0 ||
|
||||
!currentSelectionString.includes(' ')
|
||||
) {
|
||||
void replyToMessage(messageId);
|
||||
currentSelection?.empty();
|
||||
e.preventDefault();
|
||||
return;
|
||||
if ((e.target as any).localName !== 'em-emoji-picker') {
|
||||
if (
|
||||
!currentSelectionString ||
|
||||
currentSelectionString.length === 0 ||
|
||||
!/\s/.test(currentSelectionString)
|
||||
) {
|
||||
// if multiple word are selected, consider that this double click was actually NOT used to reply to
|
||||
// but to select
|
||||
void replyToMessage(messageId);
|
||||
currentSelection?.empty();
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue