0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

Minor fix on previous commit.

This commit is contained in:
Andrey Antukh 2021-05-27 18:12:29 +02:00
parent a3eb5e2928
commit f47bb6bcd0
2 changed files with 6 additions and 20 deletions

View file

@ -82,27 +82,13 @@
(defn encode-style-value
[v]
(cond
(uuid? v) (str "u:" v)
(string? v) (str "s:" v)
(number? v) (str "n:" v)
(keyword? v) (str "k:" (name v))
(map? v) (str "m:" (t/encode v))
(nil? v) (str "z:null")
:else (str "o:" v)))
#?(:cljs (t/encode v)
:clj (t/encode-str v)))
(defn decode-style-value
[v]
(let [prefix (subs v 0 2)]
(case prefix
"s:" (subs v 2)
"n:" (js/Number (subs v 2))
"k:" (keyword (subs v 2))
"m:" (t/decode (subs v 2))
"u:" (uuid/uuid (subs v 2))
"z:" nil
"o:" (subs v 2)
v)))
#?(:cljs (t/decode v)
:clj (t/decode-str v)))
(defn encode-style
[key val]

View file

@ -20,8 +20,8 @@
:font-weight "400",
:font-style "normal",
:text text}]}]}]}]
(cljs.pprint/pprint (txt/convert-to-draft content))
(cljs.pprint/pprint (txt/convert-from-draft (txt/convert-to-draft content)))
;; (cljs.pprint/pprint (txt/convert-to-draft content))
;; (cljs.pprint/pprint (txt/convert-from-draft (txt/convert-to-draft content)))
(t/is (= (txt/convert-from-draft (txt/convert-to-draft content))
content))))