0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-20 19:51:23 -05:00

Add method and state for manage the clipboard.

This commit is contained in:
Andrey Antukh 2016-02-27 21:18:51 +02:00
parent c2821ea617
commit 11e399ae21

View file

@ -3,6 +3,25 @@
[uxbox.ui.mixins :as mx]
[uxbox.ui.lightbox :as lightbox]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; State
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defonce ^:private state (atom #queue []))
(defonce ^:private ^:const +max-items+ 5)
(defn add
[item]
(swap! state (fn [v]
(let [v (conj v item)]
(if (> (count v) +max-items+)
(pop v)
v)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Component
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- clipboard-dialog-render
[own]
(html