🐛 Fix drag and drop files from browser or file explorer under circumstances

This commit is contained in:
Alejandro Alonso 2023-03-23 10:42:55 +01:00 committed by Alonso Torres
parent b2b91bfa57
commit d0ab0bccb9
2 changed files with 10 additions and 1 deletions

View file

@ -434,7 +434,15 @@
(:id component)
(gpt/point final-x final-y))))
;; Will trigger when the user drags an image from a browser to the viewport
;; Will trigger when the user drags an image from a browser to the viewport (firefox and chrome do it a bit different depending on the origin)
(dnd/has-type? event "Files")
(let [files (dnd/get-files event)
params {:file-id (:id file)
:position viewport-coord
:blobs (seq files)}]
(st/emit! (dwm/upload-media-workspace params)))
;; Will trigger when the user drags an image from a browser to the viewport (firefox and chrome do it a bit different depending on the origin)
(dnd/has-type? event "text/uri-list")
(let [data (dnd/get-data event "text/uri-list")
lines (str/lines data)