diff --git a/CHANGES.md b/CHANGES.md index 634fd470e..706c30f83 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -53,6 +53,7 @@ - Select children after ungroup action [Taiga #4917](https://tree.taiga.io/project/penpot/issue/4917) - Fix problem with guides not showing when moving over nested frames [Taiga #4905](https://tree.taiga.io/project/penpot/issue/4905) - Fix change email and password for users signed in via social login [Taiga #4273](https://tree.taiga.io/project/penpot/issue/4273) +- Fix drag and drop files from browser or file explorer under circumstances [Taiga #5054](https://tree.taiga.io/project/penpot/issue/5054) ### :heart: Community contributions by (Thank you!) - To @ondrejkonec: for contributing to the code with: diff --git a/frontend/src/app/main/ui/workspace/viewport/actions.cljs b/frontend/src/app/main/ui/workspace/viewport/actions.cljs index 8d1a12551..a18d24bd3 100644 --- a/frontend/src/app/main/ui/workspace/viewport/actions.cljs +++ b/frontend/src/app/main/ui/workspace/viewport/actions.cljs @@ -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)