mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
🐛 Fix drag and drop in the dashboard generates import file error message
This commit is contained in:
parent
8b0339bbab
commit
0d87dc5680
1 changed files with 27 additions and 21 deletions
|
@ -495,17 +495,20 @@
|
|||
(mf/use-fn
|
||||
(mf/deps selected-project)
|
||||
(fn [e]
|
||||
(when (dnd/has-type? e "penpot/files")
|
||||
(cond
|
||||
(dnd/has-type? e "penpot/files")
|
||||
(do
|
||||
(dom/prevent-default e)
|
||||
(when-not (or (dnd/from-child? e)
|
||||
(dnd/broken-event? e))
|
||||
(when (not= selected-project project-id)
|
||||
(reset! dragging? true))))
|
||||
|
||||
(when (or (dnd/has-type? e "Files")
|
||||
(or (dnd/has-type? e "Files")
|
||||
(dnd/has-type? e "application/x-moz-file"))
|
||||
(do
|
||||
(dom/prevent-default e)
|
||||
(reset! dragging? true))))
|
||||
(reset! dragging? true)))))
|
||||
|
||||
on-drag-over
|
||||
(mf/use-fn
|
||||
|
@ -531,19 +534,22 @@
|
|||
(mf/use-fn
|
||||
(mf/deps files selected-files)
|
||||
(fn [e]
|
||||
(when (or (dnd/has-type? e "Files")
|
||||
(dnd/has-type? e "application/x-moz-file"))
|
||||
(dom/prevent-default e)
|
||||
(reset! dragging? false)
|
||||
(import-files (.-files (.-dataTransfer e))))
|
||||
|
||||
(when (dnd/has-type? e "penpot/files")
|
||||
(cond
|
||||
(dnd/has-type? e "penpot/files")
|
||||
(do
|
||||
(reset! dragging? false)
|
||||
(when (not= selected-project project-id)
|
||||
(let [data {:ids (into #{} (keys selected-files))
|
||||
:project-id project-id}
|
||||
mdata {:on-success on-drop-success}]
|
||||
(st/emit! (dd/move-files (with-meta data mdata))))))))]
|
||||
(st/emit! (dd/move-files (with-meta data mdata))))))
|
||||
|
||||
(or (dnd/has-type? e "Files")
|
||||
(dnd/has-type? e "application/x-moz-file"))
|
||||
(do
|
||||
(dom/prevent-default e)
|
||||
(reset! dragging? false)
|
||||
(import-files (.-files (.-dataTransfer e)))))))]
|
||||
|
||||
[:div.dashboard-grid {:on-drag-enter on-drag-enter
|
||||
:on-drag-over on-drag-over
|
||||
|
|
Loading…
Reference in a new issue