0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-03 10:31:38 -05:00

Add copy-icon event.

This commit is contained in:
Andrey Antukh 2016-10-21 16:41:39 +02:00
parent 2764ea0d96
commit 6e06779cc3

View file

@ -319,6 +319,25 @@
[id]
(ToggleIconSelection. id))
;; --- Copy Icon
(defrecord CopySelected [id]
rs/WatchEvent
(-apply-watch [_ state stream]
(let [selected (get-in state [:dashboard :icons :selected])
selected (map #(get-in state [:icons-by-id %]) selected)]
(->> (rx/from-coll selected)
(rx/map #(dissoc % :id))
(rx/map #(assoc % :collection id))
(rx/flat-map #(rp/req :create/icon %))
(rx/map :payload)
(rx/map icon-created)))))
(defn copy-selected
[id]
{:pre [(or (uuid? id) (nil? id))]}
(CopySelected. id))
;; --- Delete Selected
(defrecord DeleteSelected []