enhance: ask clipboard permission

Notice, it still doesn't work for firefox.
This commit is contained in:
Tienson Qin
2021-07-25 17:54:50 +08:00
parent 92e61e8889
commit 1008efdc0d
2 changed files with 20 additions and 4 deletions

View File

@@ -45,7 +45,8 @@
[goog.object :as gobj]
[lambdaisland.glogi :as log]
[medley.core :as medley]
[promesa.core :as p]))
[promesa.core :as p]
["/frontend/utils" :as utils]))
;; FIXME: should support multiple images concurrently uploading
@@ -3072,8 +3073,9 @@
(defn paste-text-in-one-block-at-point
[]
(.then
(js/navigator.clipboard.readText)
(utils/getClipText
(fn [clipboard-data]
(when-let [_ (state/get-input)]
(state/append-current-edit-content! clipboard-data)))))
(state/append-current-edit-content! clipboard-data)))
(fn [error]
(js/console.error error))))