@@ -349,20 +349,15 @@ Template.room.events
349
349
return
350
350
351
351
items = e .originalEvent .clipboardData .items
352
+ files = []
352
353
for item in items
353
354
if item .kind is ' file' and item .type .indexOf (' image/' ) isnt - 1
354
355
e .preventDefault ()
356
+ files .push
357
+ file : item .getAsFile ()
358
+ name : ' Clipboard'
355
359
356
- blob = item .getAsFile ()
357
-
358
- newFile = new (FS .File )(blob)
359
- newFile .name (' Clipboard' )
360
- newFile .rid = Session .get (' openedRoom' )
361
- newFile .recId = Random .id ()
362
- newFile .userId = Meteor .userId ()
363
- Files .insert newFile, (error , fileObj ) ->
364
- unless error
365
- toastr .success ' Upload from clipboard succeeded!'
360
+ fileUpload files
366
361
367
362
' keydown .input-message ' : (event ) ->
368
363
Template .instance ().chatMessages .keydown (@_id , event, Template .instance ())
@@ -547,14 +542,13 @@ Template.room.events
547
542
' dropped .dropzone-overlay ' : (e ) ->
548
543
e .currentTarget .parentNode .classList .remove ' over'
549
544
545
+ files = []
550
546
FS ? .Utility ? .eachFile e, (file ) ->
551
- newFile = new (FS .File )(file)
552
- newFile .rid = Session .get (' openedRoom' )
553
- newFile .recId = Random .id ()
554
- newFile .userId = Meteor .userId ()
555
- Files .insert newFile, (error , fileObj ) ->
556
- unless error
557
- toastr .success ' Upload succeeded!'
547
+ files .push
548
+ file : file
549
+ name : file .name
550
+
551
+ fileUpload files
558
552
559
553
' click .deactivate ' : ->
560
554
username = Session .get (' showUserInfo' )
0 commit comments