Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,28 @@ export function Prompt(props: PromptProps) {
event.preventDefault()
return
}
// ===== 新增:检测剪贴板图片二进制数据 =====
// Windows 终端无法通过 bracketed paste 传输图片二进制数据
// 需要直接从 clipboardData 检测图片
if (event.clipboardData?.items) {
for (const item of event.clipboardData.items) {
if (item.type.startsWith("image/")) {
event.preventDefault()
const file = item.getAsFile()
if (file) {
const buffer = await file.arrayBuffer()
const base64 = Buffer.from(buffer).toString("base64")
await pasteImage({
filename: "clipboard",
mime: item.type,
content: base64,
})
return
}
}
}
}
// ===== 新增结束

// Normalize line endings at the boundary
// Windows ConPTY/Terminal often sends CR-only newlines in bracketed paste
Expand Down
Loading