mirror of
https://github.com/penpot/penpot.git
synced 2025-02-02 04:19:08 -05:00
✨ Fix a viewer can drop a .penpot file on dashboard
This commit is contained in:
parent
134c23c70c
commit
e1e13bcfb1
1 changed files with 26 additions and 22 deletions
|
@ -457,12 +457,14 @@
|
||||||
on-drop
|
on-drop
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(when (and (not (dnd/has-type? e "penpot/files"))
|
(if can-edit
|
||||||
(or (dnd/has-type? e "Files")
|
(when (and (not (dnd/has-type? e "penpot/files"))
|
||||||
(dnd/has-type? e "application/x-moz-file")))
|
(or (dnd/has-type? e "Files")
|
||||||
(dom/prevent-default e)
|
(dnd/has-type? e "application/x-moz-file")))
|
||||||
(reset! dragging? false)
|
(dom/prevent-default e)
|
||||||
(import-files (.-files (.-dataTransfer e))))))]
|
(reset! dragging? false)
|
||||||
|
(import-files (.-files (.-dataTransfer e))))
|
||||||
|
(dom/prevent-default e))))]
|
||||||
|
|
||||||
[:div {:class (stl/css :dashboard-grid)
|
[:div {:class (stl/css :dashboard-grid)
|
||||||
:dragabble (dm/str can-edit)
|
:dragabble (dm/str can-edit)
|
||||||
|
@ -576,24 +578,26 @@
|
||||||
|
|
||||||
on-drop
|
on-drop
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps files selected-files)
|
(mf/deps files selected-files can-edit)
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(cond
|
(if can-edit
|
||||||
(dnd/has-type? e "penpot/files")
|
(cond
|
||||||
(do
|
(dnd/has-type? e "penpot/files")
|
||||||
(reset! dragging? false)
|
(do
|
||||||
(when (not= selected-project project-id)
|
(reset! dragging? false)
|
||||||
(let [data {:ids (into #{} (keys selected-files))
|
(when (not= selected-project project-id)
|
||||||
:project-id project-id}
|
(let [data {:ids (into #{} (keys selected-files))
|
||||||
mdata {:on-success on-drop-success}]
|
:project-id project-id}
|
||||||
(st/emit! (dd/move-files (with-meta data mdata))))))
|
mdata {:on-success on-drop-success}]
|
||||||
|
(st/emit! (dd/move-files (with-meta data mdata))))))
|
||||||
|
|
||||||
(or (dnd/has-type? e "Files")
|
(or (dnd/has-type? e "Files")
|
||||||
(dnd/has-type? e "application/x-moz-file"))
|
(dnd/has-type? e "application/x-moz-file"))
|
||||||
(do
|
(do
|
||||||
(dom/prevent-default e)
|
(dom/prevent-default e)
|
||||||
(reset! dragging? false)
|
(reset! dragging? false)
|
||||||
(import-files (.-files (.-dataTransfer e)))))))]
|
(import-files (.-files (.-dataTransfer e)))))
|
||||||
|
(dom/prevent-default e))))]
|
||||||
|
|
||||||
[:div {:class (stl/css :dashboard-grid)
|
[:div {:class (stl/css :dashboard-grid)
|
||||||
:dragabble (dm/str can-edit)
|
:dragabble (dm/str can-edit)
|
||||||
|
|
Loading…
Add table
Reference in a new issue