From 6c028eda2a484a21634597b962989b8af73e496e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 15 May 2026 18:38:08 +0200 Subject: [PATCH] Shared Media / Links: Add Copy Link context action Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/common/WebLink.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/common/WebLink.tsx b/src/components/common/WebLink.tsx index 3c2e15479..99a05e50c 100644 --- a/src/components/common/WebLink.tsx +++ b/src/components/common/WebLink.tsx @@ -12,6 +12,7 @@ import { } from '../../global/helpers'; import { selectWebPageFromMessage } from '../../global/selectors'; import buildClassName from '../../util/buildClassName'; +import { copyTextToClipboard } from '../../util/clipboard'; import { formatPastTimeShort } from '../../util/dates/oldDateFormat'; import trimText from '../../util/trimText'; import { renderMessageSummary } from './helpers/renderMessageText'; @@ -128,6 +129,15 @@ const WebLink = ({ if (!url) return undefined; + const mergedContextActions: MenuItemContextAction[] | undefined = contextActions && [ + { + title: lang('CopyLink'), + icon: 'copy', + handler: () => copyTextToClipboard(url), + }, + ...contextActions, + ]; + const truncatedDescription = !senderTitle && description && trimText(description, MAX_TEXT_LENGTH); const className = buildClassName( @@ -152,7 +162,7 @@ const WebLink = ({ message={message} isProtected={isProtected} observeIntersection={observeIntersection} - contextActions={contextActions} + contextActions={mergedContextActions} /> )}
@@ -198,7 +208,7 @@ const WebLink = ({ onCloseAnimationEnd={handleContextMenuHide} withPortal > - {contextActions.map((action) => ( + {mergedContextActions!.map((action) => ( ('isSeparator' in action) ? ( ) : (