@@ -83,7 +83,10 @@ import {
8383 TimelineRowTimestamp ,
8484} from "./TimelineRowParts" ;
8585import { UserMessageContextReferenceChip } from "./UserMessageContextChips" ;
86- import { resolvePreviewAnnotationImage } from "./TimelineUserMessageRow.logic" ;
86+ import {
87+ resolvePreviewAnnotationImage ,
88+ userMessageFileLabel ,
89+ } from "./TimelineUserMessageRow.logic" ;
8790
8891// Drawn inside the media so dark screenshots keep an edge on the dark background.
8992const MEDIA_EDGE_CLASS_NAME =
@@ -101,7 +104,7 @@ function UserFileCard({
101104} ) {
102105 const ctx = use ( TimelineRowCtx ) ;
103106 const pastedText = file . source ?. _tag === "pasted-text" ;
104- const label = pastedText ? "Pasted text" : file . name ;
107+ const label = userMessageFileLabel ( file ) ;
105108 const extension = / \. ( [ a - z 0 - 9 ] { 1 , 8 } ) $ / i. exec ( file . name ) ?. [ 1 ] ?. toUpperCase ( ) ?? "File" ;
106109 const identity = (
107110 < >
@@ -524,8 +527,19 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
524527 . split ( / \r ? \n / )
525528 . find ( ( line ) => line . trim ( ) . length > 0 )
526529 ?. trim ( ) ?? "" ;
530+ const mediaCopyRecords = mediaOnly
531+ ? resolvedContext . records . flatMap ( ( record ) => {
532+ const known = asKnownContextRecord ( record ) ;
533+ return ( known ?. kind === "image" || known ?. kind === "file" ) &&
534+ ( regularImages . some ( ( image ) => image . id === known . attachmentId ) ||
535+ userVideos . some ( ( file ) => file . id === known . attachmentId ) )
536+ ? [ known ]
537+ : [ ] ;
538+ } )
539+ : [ ] ;
540+ const copyRecords = mediaOnly ? mediaCopyRecords : resolvedContext . records ;
527541 const contextClipboardFragment =
528- resolvedContext . records . length === 0
542+ copyRecords . length === 0
529543 ? null
530544 : encodeComposerContextFragment ( {
531545 version : 1 ,
@@ -534,22 +548,10 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
534548 ...( ctx . threadRef ? { threadId : ctx . threadRef . threadId } : { } ) ,
535549 messageId : row . message . id ,
536550 } ,
537- records : resolvedContext . records ,
551+ records : copyRecords ,
538552 } ) ;
539553 const copyText =
540- resolvedContext . text ||
541- ( mediaOnly && contextClipboardFragment
542- ? resolvedContext . records
543- . flatMap ( ( record ) => {
544- const known = asKnownContextRecord ( record ) ;
545- return ( known ?. kind === "image" || known ?. kind === "file" ) &&
546- ( regularImages . some ( ( image ) => image . id === known . attachmentId ) ||
547- userVideos . some ( ( file ) => file . id === known . attachmentId ) )
548- ? [ formatComposerContextReference ( known ) ]
549- : [ ] ;
550- } )
551- . join ( "\n" )
552- : "" ) ;
554+ resolvedContext . text || mediaCopyRecords . map ( formatComposerContextReference ) . join ( "\n" ) ;
553555 const onBodyCopyCapture = ( event : React . ClipboardEvent < HTMLDivElement > ) => {
554556 if ( resolvedContext . records . length === 0 || ! event . clipboardData ) return ;
555557 const selection = window . getSelection ( ) ;
@@ -660,7 +662,10 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
660662 ? cn (
661663 "col-span-2" ,
662664 standaloneMedia
663- ? cn ( MEDIA_EDGE_CLASS_NAME , "justify-self-end overflow-hidden rounded-2xl" )
665+ ? cn (
666+ MEDIA_EDGE_CLASS_NAME ,
667+ "min-h-16 justify-self-end overflow-hidden rounded-2xl" ,
668+ )
664669 : SNAP_SHOT_ATTACHMENT_FRAME_CLASS ,
665670 )
666671 : loneImage
@@ -901,7 +906,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
901906 < div className = "mb-2 flex flex-col gap-1" >
902907 { unchippedFiles . map ( ( file ) => {
903908 const pastedText = file . source ?. _tag === "pasted-text" ;
904- const label = pastedText ? "Pasted text" : file . name ;
909+ const label = userMessageFileLabel ( file ) ;
905910 const fileIdentity = (
906911 < >
907912 < PierreEntryIcon
0 commit comments