@@ -123,7 +123,15 @@ import { orchestrationV2WorktreePending } from "@t3tools/shared/orchestrationV2T
123123import { resolveThreadReferenceCopyTarget } from "@t3tools/client-runtime/thread-reference" ;
124124import { resolveTerminalSessionLabel } from "@t3tools/shared/terminalLabels" ;
125125import { useAtomValue } from "@effect/atom-react" ;
126- import { type SetStateAction , use , useEffect , useLayoutEffect , useRef , useState } from "react" ;
126+ import {
127+ type MouseEvent as ReactMouseEvent ,
128+ type SetStateAction ,
129+ use ,
130+ useEffect ,
131+ useLayoutEffect ,
132+ useRef ,
133+ useState ,
134+ } from "react" ;
127135import { BackgroundThreadContext } from "./chat/backgroundThread" ;
128136import { WorkspaceMutationIdContext } from "./chat/ChatMarkdownMedia" ;
129137import { useLocation , useNavigate } from "@tanstack/react-router" ;
@@ -3318,6 +3326,7 @@ export default function ChatView(props: ChatViewProps) {
33183326 data-chat-column-maximized-away = { rightPanelMaximized ? "true" : "false" }
33193327 data-chat-column
33203328 inert = { rightPanelMaximized }
3329+ onMouseUp = { preventMiddleClickPasteOutsideEditable }
33213330 >
33223331 { embedded ? null : (
33233332 < header
@@ -4045,6 +4054,12 @@ export default function ChatView(props: ChatViewProps) {
40454054 ) ;
40464055}
40474056
4057+ // Chromium on Linux pastes PRIMARY into the focused editable unless the middle mouseup is cancelled.
4058+ function preventMiddleClickPasteOutsideEditable ( event : ReactMouseEvent ) {
4059+ if ( event . button !== 1 || isEditableFocused ( event . target ) ) return ;
4060+ event . preventDefault ( ) ;
4061+ }
4062+
40484063function PreviewSessionSync ( props : { readonly threadRef : ScopedThreadRef } ) {
40494064 usePreviewSession ( props . threadRef ) ;
40504065 return null ;
0 commit comments