mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 08:21:38 +02:00
🐛 Add two more fixes to v2 migration
This commit is contained in:
parent
3bbd2023a4
commit
1f5991112d
2 changed files with 37 additions and 2 deletions
|
@ -118,6 +118,24 @@
|
||||||
(vswap! detached-ids conj (:id shape)))
|
(vswap! detached-ids conj (:id shape)))
|
||||||
(ctk/detach-shape shape)))
|
(ctk/detach-shape shape)))
|
||||||
|
|
||||||
|
remove-missing-children
|
||||||
|
(fn [file-data]
|
||||||
|
;; Remove any child that does not exist.
|
||||||
|
(letfn [(fix-container
|
||||||
|
[container]
|
||||||
|
(update container :objects update-vals (partial fix-shape container)))
|
||||||
|
|
||||||
|
(fix-shape
|
||||||
|
[container shape]
|
||||||
|
(let [objects (:objects container)]
|
||||||
|
(d/update-when shape :shapes
|
||||||
|
(fn [shapes]
|
||||||
|
(d/removev #(nil? (get objects %)) shapes)))))]
|
||||||
|
|
||||||
|
(-> file-data
|
||||||
|
(update :pages-index update-vals fix-container)
|
||||||
|
(update :components update-vals fix-container))))
|
||||||
|
|
||||||
fix-missing-image-metadata
|
fix-missing-image-metadata
|
||||||
(fn [file-data]
|
(fn [file-data]
|
||||||
(let [update-object
|
(let [update-object
|
||||||
|
@ -356,6 +374,23 @@
|
||||||
(update :pages-index update-vals fix-container)
|
(update :pages-index update-vals fix-container)
|
||||||
(update :components update-vals fix-container))))
|
(update :components update-vals fix-container))))
|
||||||
|
|
||||||
|
fix-path-copies
|
||||||
|
(fn [file-data]
|
||||||
|
;; If the user has created a copy and then converted into a path, detach it
|
||||||
|
;; because the synchronization will no longer work.
|
||||||
|
(letfn [(fix-container [container]
|
||||||
|
(update container :objects update-vals fix-shape))
|
||||||
|
|
||||||
|
(fix-shape [shape]
|
||||||
|
(if (and (ctk/instance-head? shape)
|
||||||
|
(cfh/path-shape? shape))
|
||||||
|
(ctk/detach-shape shape)
|
||||||
|
shape))]
|
||||||
|
|
||||||
|
(-> file-data
|
||||||
|
(update :pages-index update-vals fix-container)
|
||||||
|
(update :components update-vals fix-container))))
|
||||||
|
|
||||||
transform-to-frames
|
transform-to-frames
|
||||||
(fn [file-data]
|
(fn [file-data]
|
||||||
;; Transform component and copy heads to frames, and set the
|
;; Transform component and copy heads to frames, and set the
|
||||||
|
@ -450,6 +485,7 @@
|
||||||
(update :components update-vals fix-container))))]
|
(update :components update-vals fix-container))))]
|
||||||
|
|
||||||
(-> file-data
|
(-> file-data
|
||||||
|
(remove-missing-children)
|
||||||
(fix-misc-shape-issues)
|
(fix-misc-shape-issues)
|
||||||
(fix-recent-colors)
|
(fix-recent-colors)
|
||||||
(fix-missing-image-metadata)
|
(fix-missing-image-metadata)
|
||||||
|
@ -460,6 +496,7 @@
|
||||||
(fix-orphan-copies)
|
(fix-orphan-copies)
|
||||||
(remap-refs)
|
(remap-refs)
|
||||||
(fix-copies-of-detached)
|
(fix-copies-of-detached)
|
||||||
|
(fix-path-copies)
|
||||||
(transform-to-frames)
|
(transform-to-frames)
|
||||||
(remap-frame-ids)
|
(remap-frame-ids)
|
||||||
(fix-frame-ids)
|
(fix-frame-ids)
|
||||||
|
|
|
@ -780,5 +780,3 @@
|
||||||
(-> data
|
(-> data
|
||||||
(update :pages-index update-vals update-container)
|
(update :pages-index update-vals update-container)
|
||||||
(update :components update-vals update-container))))
|
(update :components update-vals update-container))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue