♻️ Replace frontend transit ns usage with common transit.

This commit is contained in:
Andrey Antukh 2021-05-31 09:20:44 +02:00 committed by Andrés Moya
parent 2ec769981a
commit 068c94da4e
18 changed files with 43 additions and 179 deletions

View file

@ -7,9 +7,9 @@
(ns app.util.dom.dnd
"Drag & Drop interop helpers."
(:require
[cuerdas.core :as str]
[app.common.transit :as t]
[app.util.data :refer (read-string)]
[app.util.transit :as t]))
[cuerdas.core :as str]))
;; This is the official documentation for the dnd API:
;; https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API
@ -59,7 +59,7 @@
(let [dt (.-dataTransfer e)]
(if (or (str/starts-with? data-type "application")
(str/starts-with? data-type "penpot"))
(.setData dt data-type (t/encode data))
(.setData dt data-type (t/encode-str data))
(.setData dt data-type data))
e)))
@ -112,7 +112,7 @@
(let [dt (.-dataTransfer e)]
(if (or (str/starts-with? data-type "penpot")
(= data-type "application/json"))
(t/decode (.getData dt data-type))
(t/decode-str (.getData dt data-type))
(.getData dt data-type)))))
(defn get-files