@@ -110,7 +110,7 @@ export function ChatBar(props: {
110
110
images . map ( async ( image ) => {
111
111
const b64 = await uploadImageMutation . mutateAsync ( image ) ;
112
112
return { file : image , b64 : b64 } ;
113
- } ) ,
113
+ } )
114
114
) ;
115
115
116
116
setImages ( ( prev ) => [ ...prev , ...urls ] ) ;
@@ -127,8 +127,15 @@ export function ChatBar(props: {
127
127
< div
128
128
className = { cn (
129
129
"overflow-hidden rounded-2xl border border-border bg-card" ,
130
- props . className ,
130
+ props . className
131
131
) }
132
+ onDrop = { ( e ) => {
133
+ e . preventDefault ( ) ;
134
+ if ( ! props . allowImageUpload ) return ;
135
+ const files = Array . from ( e . dataTransfer . files ) ;
136
+ if ( files . length > 0 ) handleImageUpload ( files ) ;
137
+ } }
138
+ onDragOver = { ( e ) => e . preventDefault ( ) }
132
139
>
133
140
{ images . length > 0 && (
134
141
< ImagePreview
@@ -146,6 +153,14 @@ export function ChatBar(props: {
146
153
placeholder = { props . placeholder }
147
154
value = { message }
148
155
onChange = { ( e ) => setMessage ( e . target . value ) }
156
+ onPaste = { ( e ) => {
157
+ if ( ! props . allowImageUpload ) return ;
158
+ const files = Array . from ( e . clipboardData . files ) ;
159
+ if ( files . length > 0 ) {
160
+ e . preventDefault ( ) ;
161
+ handleImageUpload ( files ) ;
162
+ }
163
+ } }
149
164
onKeyDown = { ( e ) => {
150
165
// ignore if shift key is pressed to allow entering new lines
151
166
if ( e . shiftKey ) {
@@ -266,7 +281,7 @@ export function ChatBar(props: {
266
281
`You can only upload up to ${ maxAllowedImagesPerMessage } images at a time` ,
267
282
{
268
283
position : "top-right" ,
269
- } ,
284
+ }
270
285
) ;
271
286
return ;
272
287
}
@@ -543,7 +558,7 @@ function WalletSelector(props: {
543
558
key = { wallet . address }
544
559
className = { cn (
545
560
"flex cursor-pointer items-center justify-between px-3 py-4 hover:bg-accent/50" ,
546
- props . selectedAddress === wallet . address && "bg-accent/50" ,
561
+ props . selectedAddress === wallet . address && "bg-accent/50"
547
562
) }
548
563
onKeyDown = { ( e ) => {
549
564
if ( e . key === "Enter" || e . key === " " ) {
0 commit comments