Message: Make some elements unselectable (#5707)
This commit is contained in:
parent
bb8b9c4f20
commit
32146587fb
@ -412,7 +412,7 @@ const Audio: FC<OwnProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div className={fullClassName} dir={lang.isRtl ? 'rtl' : 'ltr'}>
|
<div className={fullClassName} dir={lang.isRtl ? 'rtl' : 'ltr'}>
|
||||||
{isSelectable && (
|
{isSelectable && (
|
||||||
<div className="message-select-control">
|
<div className="message-select-control no-selection">
|
||||||
{isSelected && <Icon name="select" />}
|
{isSelected && <Icon name="select" />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ const File: FC<OwnProps> = ({
|
|||||||
return (
|
return (
|
||||||
<div ref={elementRef} className={fullClassName} dir={lang.isRtl ? 'rtl' : undefined}>
|
<div ref={elementRef} className={fullClassName} dir={lang.isRtl ? 'rtl' : undefined}>
|
||||||
{isSelectable && (
|
{isSelectable && (
|
||||||
<div className="message-select-control">
|
<div className="message-select-control no-selection">
|
||||||
{isSelected && <Icon name="select" />}
|
{isSelected && <Icon name="select" />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -148,6 +148,7 @@ const FullNameTitle: FC<OwnProps> = ({
|
|||||||
>
|
>
|
||||||
<CustomEmoji
|
<CustomEmoji
|
||||||
forceAlways
|
forceAlways
|
||||||
|
className="no-selection"
|
||||||
withSparkles={emojiStatus.type === 'collectible'}
|
withSparkles={emojiStatus.type === 'collectible'}
|
||||||
sparklesClassName="statusSparkles"
|
sparklesClassName="statusSparkles"
|
||||||
sparklesStyle={buildStyle(statusSparklesColor && `color: ${statusSparklesColor}`)}
|
sparklesStyle={buildStyle(statusSparklesColor && `color: ${statusSparklesColor}`)}
|
||||||
|
|||||||
@ -231,6 +231,7 @@ const EmbeddedMessage: FC<OwnProps> = ({
|
|||||||
className,
|
className,
|
||||||
isQuote && 'is-quote',
|
isQuote && 'is-quote',
|
||||||
mediaThumbnail && 'with-thumb',
|
mediaThumbnail && 'with-thumb',
|
||||||
|
'no-selection',
|
||||||
)}
|
)}
|
||||||
dir={lang.isRtl ? 'rtl' : undefined}
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
|
|||||||
@ -365,9 +365,11 @@ const ContextMenuContainer: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
const selectionText = getSelectionAsFormattedText(selectionRange);
|
const selectionText = getSelectionAsFormattedText(selectionRange);
|
||||||
|
|
||||||
|
const messageText = message.content.text!.text!.replace(/\u00A0/g, ' ');
|
||||||
|
|
||||||
setCanQuoteSelection(
|
setCanQuoteSelection(
|
||||||
selectionText.text.trim().length > 0
|
selectionText.text.trim().length > 0
|
||||||
&& message.content.text!.text!.includes(selectionText.text),
|
&& messageText.includes(selectionText.text),
|
||||||
);
|
);
|
||||||
}, [
|
}, [
|
||||||
selectionRange, selectionRange?.collapsed, selectionRange?.startOffset, selectionRange?.endOffset,
|
selectionRange, selectionRange?.collapsed, selectionRange?.startOffset, selectionRange?.endOffset,
|
||||||
|
|||||||
@ -1513,6 +1513,7 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
{!asForwarded && senderEmojiStatus && (
|
{!asForwarded && senderEmojiStatus && (
|
||||||
<CustomEmoji
|
<CustomEmoji
|
||||||
documentId={senderEmojiStatus.documentId}
|
documentId={senderEmojiStatus.documentId}
|
||||||
|
className="no-selection"
|
||||||
loopLimit={EMOJI_STATUS_LOOP_LIMIT}
|
loopLimit={EMOJI_STATUS_LOOP_LIMIT}
|
||||||
observeIntersectionForLoading={observeIntersectionForLoading}
|
observeIntersectionForLoading={observeIntersectionForLoading}
|
||||||
observeIntersectionForPlaying={observeIntersectionForPlaying}
|
observeIntersectionForPlaying={observeIntersectionForPlaying}
|
||||||
@ -1587,13 +1588,15 @@ const Message: FC<OwnProps & StateProps> = ({
|
|||||||
data-should-update-views={message.viewsCount !== undefined}
|
data-should-update-views={message.viewsCount !== undefined}
|
||||||
/>
|
/>
|
||||||
{!isInDocumentGroup && (
|
{!isInDocumentGroup && (
|
||||||
<div className="message-select-control">
|
<div className="message-select-control no-selection">
|
||||||
{isSelected && <Icon name="select" />}
|
{isSelected && <Icon name="select" />}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{isLastInDocumentGroup && (
|
{isLastInDocumentGroup && (
|
||||||
<div
|
<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}
|
onClick={handleDocumentGroupSelectAll}
|
||||||
>
|
>
|
||||||
{isGroupSelected && (
|
{isGroupSelected && (
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
// Common styles for all media-type components across the app.
|
// Common styles for all media-type components across the app.
|
||||||
.media-inner {
|
.media-inner {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
video.full-media,
|
video.full-media,
|
||||||
img.full-media,
|
img.full-media,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user