mirror of
https://github.com/penpot/penpot.git
synced 2025-05-28 21:56:12 +02:00
🐛 Add validation fix for false non root copies
This commit is contained in:
parent
cceb35b053
commit
17a208d67b
1 changed files with 6 additions and 3 deletions
|
@ -486,15 +486,18 @@
|
||||||
fix-false-copies
|
fix-false-copies
|
||||||
(fn [file-data]
|
(fn [file-data]
|
||||||
;; Find component heads that are not main-instance but have not :shape-ref.
|
;; Find component heads that are not main-instance but have not :shape-ref.
|
||||||
|
;; Also shapes that have :shape-ref but are not in a copy.
|
||||||
(letfn [(fix-container
|
(letfn [(fix-container
|
||||||
[container]
|
[container]
|
||||||
(d/update-when container :objects update-vals (partial fix-shape container)))
|
(d/update-when container :objects update-vals (partial fix-shape container)))
|
||||||
|
|
||||||
(fix-shape
|
(fix-shape
|
||||||
[container shape]
|
[container shape]
|
||||||
(if (and (ctk/instance-head? shape)
|
(if (or (and (ctk/instance-head? shape)
|
||||||
(not (ctk/main-instance? shape))
|
(not (ctk/main-instance? shape))
|
||||||
(not (ctk/in-component-copy? shape)))
|
(not (ctk/in-component-copy? shape)))
|
||||||
|
(and (ctk/in-component-copy? shape)
|
||||||
|
(nil? (ctn/get-head-shape (:objects container) shape {:allow-main? true}))))
|
||||||
(detach-shape container shape)
|
(detach-shape container shape)
|
||||||
shape))]
|
shape))]
|
||||||
(-> file-data
|
(-> file-data
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue