@@ -11,6 +11,8 @@ import {
1111import { useShallow } from 'zustand/react/shallow'
1212
1313import { routeUserPrompt , addBashMessageToHistory } from './commands/router'
14+ import { addPendingImageFromFile } from './utils/add-pending-image'
15+ import { getProjectRoot } from './project-files'
1416import { AnnouncementBanner } from './components/announcement-banner'
1517import { hasClipboardImage , readClipboardImage } from './utils/clipboard-image'
1618import { showClipboardMessage } from './utils/clipboard'
@@ -1013,33 +1015,21 @@ export const Chat = ({
10131015 onBashHistoryUp : navigateUp ,
10141016 onBashHistoryDown : navigateDown ,
10151017 onPasteImage : ( ) => {
1016- // Check if clipboard has an image
10171018 if ( ! hasClipboardImage ( ) ) {
1018- // No image in clipboard, let normal paste happen
10191019 return false
10201020 }
10211021
1022- // Read image from clipboard
10231022 const result = readClipboardImage ( )
10241023 if ( ! result . success || ! result . imagePath || ! result . filename ) {
10251024 showClipboardMessage ( result . error || 'Failed to paste image' , {
10261025 durationMs : 3000 ,
10271026 } )
1028- return true // We handled it (with an error), don't let default paste happen
1027+ return true
10291028 }
10301029
1031- const imagePath = result . imagePath
1032- if ( ! imagePath ) return true
1033-
1034- // Process and add image (handles compression and caching)
1035- void ( async ( ) => {
1036- const { addPendingImageFromFile } = await import ( './utils/add-pending-image' )
1037- const { getProjectRoot } = await import ( './project-files' )
1038- const cwd = getProjectRoot ( ) ?? process . cwd ( )
1039- await addPendingImageFromFile ( imagePath , cwd )
1040- } ) ( )
1041-
1042- return true // Image was pasted successfully
1030+ const cwd = getProjectRoot ( ) ?? process . cwd ( )
1031+ void addPendingImageFromFile ( result . imagePath , cwd )
1032+ return true
10431033 } ,
10441034 } ) ,
10451035 [
0 commit comments