mirror of
https://github.com/penpot/penpot.git
synced 2026-04-26 03:38:18 +00:00
✨ Add binary fills initialization on workspace fetch
This commit is contained in:
parent
b5808701ec
commit
158f759cde
@ -20,9 +20,11 @@
|
||||
[app.common.logic.shapes :as cls]
|
||||
[app.common.transit :as t]
|
||||
[app.common.types.component :as ctc]
|
||||
[app.common.types.fill :as types.fill]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape-tree :as ctst]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.main.data.changes :as dch]
|
||||
[app.main.data.comments :as dcmt]
|
||||
[app.main.data.common :as dcm]
|
||||
@ -80,6 +82,7 @@
|
||||
[app.util.timers :as tm]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.walk :as walk]
|
||||
[cuerdas.core :as str]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
@ -133,10 +136,30 @@
|
||||
(rx/of [k v])))))))
|
||||
(rx/reduce conj {})))
|
||||
|
||||
|
||||
(defn process-fills
|
||||
"A function responsible to analyze the file data or shape for references
|
||||
and apply lookup-index on it."
|
||||
[data]
|
||||
(letfn [(process-map-form [form]
|
||||
(let [fills (get form :fills)]
|
||||
(if (vector? fills)
|
||||
(assoc form :fills (types.fill/from-plain fills))
|
||||
form)))
|
||||
|
||||
(process-form [form]
|
||||
(if (map? form)
|
||||
(process-map-form form)
|
||||
form))]
|
||||
(if (contains? cf/flags :frontend-binary-fills)
|
||||
(walk/postwalk process-form data)
|
||||
data)))
|
||||
|
||||
(defn- resolve-file
|
||||
[file]
|
||||
(->> (fpmap/resolve-file file)
|
||||
(rx/map :data)
|
||||
(rx/map process-fills)
|
||||
(rx/mapcat
|
||||
(fn [{:keys [pages-index] :as data}]
|
||||
(->> (rx/from (seq pages-index))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user