Message: Make some elements unselectable (#5707)

This commit is contained in:
zubiden 2025-03-07 15:16:58 +01:00 committed by Alexander Zinchuk
parent bb8b9c4f20
commit 32146587fb
7 changed files with 13 additions and 5 deletions

View File

@ -412,7 +412,7 @@ const Audio: FC<OwnProps> = ({
return (
<div className={fullClassName} dir={lang.isRtl ? 'rtl' : 'ltr'}>
{isSelectable && (
<div className="message-select-control">
<div className="message-select-control no-selection">
{isSelected && <Icon name="select" />}
</div>
)}

View File

@ -103,7 +103,7 @@ const File: FC<OwnProps> = ({
return (
<div ref={elementRef} className={fullClassName} dir={lang.isRtl ? 'rtl' : undefined}>
{isSelectable && (
<div className="message-select-control">
<div className="message-select-control no-selection">
{isSelected && <Icon name="select" />}
</div>
)}

View File

@ -148,6 +148,7 @@ const FullNameTitle: FC<OwnProps> = ({
>
<CustomEmoji
forceAlways
className="no-selection"
withSparkles={emojiStatus.type === 'collectible'}
sparklesClassName="statusSparkles"
sparklesStyle={buildStyle(statusSparklesColor && `color: ${statusSparklesColor}`)}

View File

@ -231,6 +231,7 @@ const EmbeddedMessage: FC<OwnProps> = ({
className,
isQuote && 'is-quote',
mediaThumbnail && 'with-thumb',
'no-selection',
)}
dir={lang.isRtl ? 'rtl' : undefined}
onClick={handleClick}

View File

@ -365,9 +365,11 @@ const ContextMenuContainer: FC<OwnProps & StateProps> = ({
const selectionText = getSelectionAsFormattedText(selectionRange);
const messageText = message.content.text!.text!.replace(/\u00A0/g, ' ');
setCanQuoteSelection(
selectionText.text.trim().length > 0
&& message.content.text!.text!.includes(selectionText.text),
&& messageText.includes(selectionText.text),
);
}, [
selectionRange, selectionRange?.collapsed, selectionRange?.startOffset, selectionRange?.endOffset,

View File

@ -1513,6 +1513,7 @@ const Message: FC<OwnProps & StateProps> = ({
{!asForwarded && senderEmojiStatus && (
<CustomEmoji
documentId={senderEmojiStatus.documentId}
className="no-selection"
loopLimit={EMOJI_STATUS_LOOP_LIMIT}
observeIntersectionForLoading={observeIntersectionForLoading}
observeIntersectionForPlaying={observeIntersectionForPlaying}
@ -1587,13 +1588,15 @@ const Message: FC<OwnProps & StateProps> = ({
data-should-update-views={message.viewsCount !== undefined}
/>
{!isInDocumentGroup && (
<div className="message-select-control">
<div className="message-select-control no-selection">
{isSelected && <Icon name="select" />}
</div>
)}
{isLastInDocumentGroup && (
<div
className={buildClassName('message-select-control group-select', isGroupSelected && 'is-selected')}
className={buildClassName(
'message-select-control group-select no-selection', isGroupSelected && 'is-selected',
)}
onClick={handleDocumentGroupSelectAll}
>
{isGroupSelected && (

View File

@ -3,6 +3,7 @@
// Common styles for all media-type components across the app.
.media-inner {
position: relative;
user-select: none;
video.full-media,
img.full-media,