0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

🐛 Remove empty text shapes on comp-v2 migration

This commit is contained in:
Andrey Antukh 2024-01-25 18:05:57 +01:00
parent b1d33d4c15
commit 623b4a9858

View file

@ -243,13 +243,20 @@
fix-completly-broken-shapes fix-completly-broken-shapes
(fn [file-data] (fn [file-data]
(letfn [(update-object [objects id shape] (letfn [(update-object [objects id shape]
(if (nil? (:type shape)) (cond
(nil? (:type shape))
(let [ids (cfh/get-children-ids objects id)] (let [ids (cfh/get-children-ids objects id)]
(-> objects (-> objects
(dissoc id) (dissoc id)
(as-> $ (reduce dissoc $ ids)) (as-> $ (reduce dissoc $ ids))
(d/update-in-when [(:parent-id shape) :shapes] (d/update-in-when [(:parent-id shape) :shapes]
(fn [shapes] (filterv #(not= id %) shapes))))) (fn [shapes] (filterv #(not= id %) shapes)))))
(and (cfh/text-shape? shape)
(not (seq (:content shape))))
(dissoc objects id)
:else
objects)) objects))
(update-container [container] (update-container [container]