The best way to control Claude Code, Codex and more from any computer or phone
fix(web): Paste as Text pastes text when the clipboard also holds an image (#38475)
Julius Marminge committed
Nov 17, 2026 at 23:41 UTC
01cfac429d9854bb6a37a96735b5b2d9baf23b81
3 files changed
+10
-1
apps/web/src/components/chat/ChatComposer.tsx
+1
-1
@@ -2836,7 +2836,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2836
(!pastedContext &&
2837
activeThreadId &&
2838
files.length > 0 &&
2839
- shouldHandleComposerAttachmentPaste({ files, plainText }))
2839
+ shouldHandleComposerAttachmentPaste({ files, plainText, bypassAutoAttachment }))
2840
) {
2841
event.preventDefault();
2842
event.stopPropagation();
apps/web/src/components/chat/composerAttachmentFiles.test.ts
+6
@@ -121,6 +121,12 @@ describe("composer attachment files", () => {
121
).toBe(true);
122
});
123
124
+ it("leaves an image-and-text clipboard to the text path under Paste as Text", () => {
125
+ const image = new File(["png"], "image.png", { type: "image/png" });
126
+ const input = { files: [image], plainText: "Hello from Word", bypassAutoAttachment: true };
127
+ expect(shouldHandleComposerAttachmentPaste(input)).toBe(false);
128
+ });
129
+
130
it("preserves text when the clipboard also includes generic image files", () => {
131
const image = new File(["tiff"], "photo.tiff", { type: "image/tiff" });
132
expect(
apps/web/src/components/chat/composerAttachmentFiles.ts
+3
@@ -242,7 +242,10 @@ export function attachmentsToReleaseOnUploadCapabilityLoss(
242
export function shouldHandleComposerAttachmentPaste(input: {
243
readonly files: ReadonlyArray<File>;
244
readonly plainText: string;
245
+ readonly bypassAutoAttachment?: boolean;
246
}): boolean {
247
+ // Paste as Text keeps the text even when the source also put an image of it on the clipboard.
248
+ if (input.bypassAutoAttachment && input.plainText.length > 0) return false;
249
if (
250
input.files.some((file) => {
251
if (isDngFile(file)) return true;