mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 02:26:10 +02:00
✨ Simplify feature handling on duplicate-file
This commit is contained in:
parent
0ad2e8a0f2
commit
ca50486639
1 changed files with 25 additions and 32 deletions
|
@ -106,41 +106,34 @@
|
||||||
media
|
media
|
||||||
media))
|
media))
|
||||||
|
|
||||||
(update-fdata [fdata new-id]
|
(process-file [{:keys [id] :as file}]
|
||||||
(-> fdata
|
(-> file
|
||||||
(assoc :id new-id)
|
(update :data assoc :id id)
|
||||||
(feat.fdata/process-pointers deref)
|
(update :data feat.fdata/process-pointers deref)
|
||||||
(pmg/migrate-data)
|
(pmg/migrate-file)
|
||||||
(update :pages-index relink-shapes)
|
(update :data (fn [data]
|
||||||
(update :components relink-shapes)
|
(-> data
|
||||||
(update :media relink-media)
|
(update :pages-index relink-shapes)
|
||||||
(d/without-nils)))]
|
(update :components relink-shapes)
|
||||||
|
(update :media relink-media)
|
||||||
|
(d/without-nils))))))]
|
||||||
|
|
||||||
(binding [pmap/*load-fn* (partial feat.fdata/load-pointer cfg id)
|
(let [new-id (get index id)
|
||||||
pmap/*tracked* (pmap/create-tracked)
|
file (binding [pmap/*load-fn* (partial feat.fdata/load-pointer cfg id)]
|
||||||
cfeat/*new* (atom #{})]
|
(-> (assoc file :id new-id)
|
||||||
|
(process-file)))
|
||||||
|
|
||||||
(let [new-id (get index id)
|
file (if (contains? (:features file) "fdata/objects-map")
|
||||||
file (binding [pmap/*load-fn* (partial feat.fdata/load-pointer cfg id)
|
(feat.fdata/enable-objects-map file)
|
||||||
cfeat/*new* (atom #{})]
|
file)
|
||||||
(-> file
|
|
||||||
(assoc :id new-id)
|
|
||||||
(update :data update-fdata new-id)
|
|
||||||
(update :features into (deref cfeat/*new*))
|
|
||||||
(update :features cfeat/migrate-legacy-features)))
|
|
||||||
|
|
||||||
file (if (contains? (:features file) "fdata/objects-map")
|
file (if (contains? (:features file) "fdata/pointer-map")
|
||||||
(feat.fdata/enable-objects-map file)
|
(binding [pmap/*tracked* (pmap/create-tracked)]
|
||||||
file)
|
(let [file (feat.fdata/enable-pointer-map file)]
|
||||||
|
(feat.fdata/persist-pointers! cfg (:id file))
|
||||||
file (if (contains? (:features file) "fdata/pointer-map")
|
file))
|
||||||
(binding [pmap/*tracked* (pmap/create-tracked)]
|
file)]
|
||||||
(let [file (feat.fdata/enable-pointer-map file)]
|
file)))
|
||||||
(feat.fdata/persist-pointers! cfg (:id file))
|
|
||||||
file))
|
|
||||||
file)]
|
|
||||||
|
|
||||||
file))))
|
|
||||||
|
|
||||||
(def sql:get-used-libraries
|
(def sql:get-used-libraries
|
||||||
"select flr.*
|
"select flr.*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue