0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-28 15:41:25 -05:00

🐛 Fix remap colors on binary import

This commit is contained in:
Alejandro Alonso 2024-01-04 11:48:53 +01:00 committed by Andrey Antukh
parent 73b8f3fb17
commit 9cfc00ce97

View file

@ -593,6 +593,7 @@
(declare lookup-index)
(declare update-index)
(declare relink-media)
(declare relink-colors)
(declare relink-shapes)
(defmulti read-import ::version)
@ -723,6 +724,7 @@
(update :pages-index relink-shapes)
(update :components relink-shapes)
(update :media relink-media)
(update :colors relink-colors)
(d/without-nils))))))
@ -997,6 +999,17 @@
media
media))
(defn- relink-colors
"A function responsible of process the :colors attr of file data and
remap the old ids with the new ones."
[colors]
(reduce-kv (fn [res k v]
(if (:image v)
(update-in res [k :image :id] lookup-index)
res))
colors
colors))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; HIGH LEVEL API
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;