mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 21:09:00 -05:00
✨ Detach all assets when unlinking an external lib
This commit is contained in:
parent
c6fe19c321
commit
259b405526
3 changed files with 13 additions and 6 deletions
|
@ -594,7 +594,7 @@
|
||||||
ptk/UpdateEvent
|
ptk/UpdateEvent
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(if (not= library-id (:current-file-id state))
|
(if (not= library-id (:current-file-id state))
|
||||||
(assoc-in state [:workspace-libraries library-id :synced-at] (dt/now))
|
(d/assoc-in-when state [:workspace-libraries library-id :synced-at] (dt/now))
|
||||||
state))
|
state))
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
|
|
|
@ -326,13 +326,16 @@
|
||||||
(defn unlink-file-from-library
|
(defn unlink-file-from-library
|
||||||
[file-id library-id]
|
[file-id library-id]
|
||||||
(ptk/reify ::unlink-file-from-library
|
(ptk/reify ::unlink-file-from-library
|
||||||
|
ptk/UpdateEvent
|
||||||
|
(update [_ state]
|
||||||
|
(d/dissoc-in state [:workspace-libraries library-id]))
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(let [unlinked #(d/dissoc-in % [:workspace-libraries library-id])
|
(let [params {:file-id file-id
|
||||||
params {:file-id file-id
|
:library-id library-id}]
|
||||||
:library-id library-id}]
|
|
||||||
(->> (rp/mutation :unlink-file-from-library params)
|
(->> (rp/mutation :unlink-file-from-library params)
|
||||||
(rx/map (constantly unlinked)))))))
|
(rx/ignore))))))
|
||||||
|
|
||||||
|
|
||||||
;; --- Upload File Media objects
|
;; --- Upload File Media objects
|
||||||
|
|
|
@ -75,7 +75,11 @@
|
||||||
(mf/use-callback (mf/deps file) #(st/emit! (dw/link-file-to-library (:id file) %)))
|
(mf/use-callback (mf/deps file) #(st/emit! (dw/link-file-to-library (:id file) %)))
|
||||||
|
|
||||||
unlink-library
|
unlink-library
|
||||||
(mf/use-callback (mf/deps file) #(st/emit! (dw/unlink-file-from-library (:id file) %)))]
|
(mf/use-callback
|
||||||
|
(mf/deps file)
|
||||||
|
(fn [library-id]
|
||||||
|
(st/emit! (dw/unlink-file-from-library (:id file) library-id)
|
||||||
|
(dwl/sync-file (:id file) library-id))))]
|
||||||
[:*
|
[:*
|
||||||
[:div.section
|
[:div.section
|
||||||
[:div.section-title (tr "workspace.libraries.in-this-file")]
|
[:div.section-title (tr "workspace.libraries.in-this-file")]
|
||||||
|
|
Loading…
Add table
Reference in a new issue