mirror of
https://github.com/penpot/penpot.git
synced 2025-03-18 18:51:29 -05:00
🐛 Remove broken and unfixable image shapes on comp-v2 migration
This commit is contained in:
parent
ba3c42e62c
commit
3e89a22600
1 changed files with 22 additions and 0 deletions
|
@ -115,6 +115,27 @@
|
|||
(vswap! detached-ids conj (:id shape)))
|
||||
(ctk/detach-shape shape)))
|
||||
|
||||
|
||||
fix-missing-image-metadata
|
||||
(fn [file-data]
|
||||
(let [update-object
|
||||
(fn [objects id shape]
|
||||
(if (and (cfh/image-shape? shape)
|
||||
(nil? (:metadata shape)))
|
||||
(-> objects
|
||||
(dissoc id)
|
||||
(d/update-in-when [(:parent-id shape) :shapes]
|
||||
(fn [shapes] (filterv #(not= id %) shapes))))
|
||||
objects))
|
||||
|
||||
update-page
|
||||
(fn [page]
|
||||
(d/update-when page :objects #(reduce-kv update-object % %)))]
|
||||
|
||||
(-> file-data
|
||||
(update :pages-index update-vals update-page)
|
||||
(update :components update-vals update-page))))
|
||||
|
||||
fix-misc-shape-issues
|
||||
(fn [file-data]
|
||||
;; Find shapes that are not listed in their parent's children list.
|
||||
|
@ -388,6 +409,7 @@
|
|||
(-> file-data
|
||||
(fix-misc-shape-issues)
|
||||
(fix-recent-colors)
|
||||
(fix-missing-image-metadata)
|
||||
(fix-orphan-shapes)
|
||||
(remove-nested-roots)
|
||||
(add-not-nested-roots)
|
||||
|
|
Loading…
Add table
Reference in a new issue