1
1
1programmer2019-04-11 11:05:57
React
1programmer, 2019-04-11 11:05:57

How can I stop onClick from being executed when a message is highlighted?

Hi all.

<MessageItemWrapper 
    message={message} 
    user={user} 
    onClick={e => selectMessage(message, e)}>
      {
        userFirstMessage() && !conversation.is_channel ?
          <MessageUserAvatar src={getUserAvatarSrc(message.sender)} /> : ''
      }
      <div>
        <TimeSend>{getMessageTime(message)} {message.edited}</TimeSend>
        <MessageText message={message} user={user}>
          {parentMessage(message)}
          {forwardedMessage(message)}
          {message.message}
        </MessageText>
      </div>
    </MessageItemWrapper>

There is a component, selectMessage hangs on onClick, now if I try to select the text that is inside {message.message} I work out onClick. How can I stop its execution if I highlight text with the cursor?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question