mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 10:21:39 +02:00
✨ Make clipboard api more generic.
This commit is contained in:
parent
7e7c0dad7f
commit
a0b70b7bbd
2 changed files with 8 additions and 8 deletions
|
@ -69,18 +69,15 @@
|
|||
|
||||
(defn write-to-clipboard
|
||||
[data]
|
||||
(assert (string? data) "`data` should be string")
|
||||
(let [cboard (unchecked-get js/navigator "clipboard")]
|
||||
(.writeText cboard (uxbox.util.transit/encode data))))
|
||||
(.writeText cboard data)))
|
||||
|
||||
(defn- read-from-clipboard
|
||||
[]
|
||||
(let [cboard (unchecked-get js/navigator "clipboard")]
|
||||
(-> (.readText cboard)
|
||||
(p/then (fn [data]
|
||||
(try
|
||||
(t/decode data)
|
||||
(catch :default e
|
||||
nil)))))))
|
||||
(p/then identity))))
|
||||
|
||||
(defn request-fullscreen
|
||||
[el]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue