mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 22:49:01 -05:00
✨ Make shape ref smarter to find some subtle validation error
This commit is contained in:
parent
f9af2a16b9
commit
206f9acfd9
2 changed files with 12 additions and 1 deletions
|
@ -148,6 +148,15 @@
|
||||||
[objects id]
|
[objects id]
|
||||||
(mapv (d/getf objects) (get-children-ids-with-self objects id)))
|
(mapv (d/getf objects) (get-children-ids-with-self objects id)))
|
||||||
|
|
||||||
|
(defn get-child
|
||||||
|
"Return the child of the given object with the given id (allow that the
|
||||||
|
id may point to the object itself)."
|
||||||
|
[objects id child-id]
|
||||||
|
(let [shape (get objects id)]
|
||||||
|
(if (= id child-id)
|
||||||
|
shape
|
||||||
|
(some #(get-child objects % child-id) (:shapes shape)))))
|
||||||
|
|
||||||
(defn get-parent
|
(defn get-parent
|
||||||
"Retrieve the parent for the shape-id (if exists)"
|
"Retrieve the parent for the shape-id (if exists)"
|
||||||
[objects id]
|
[objects id]
|
||||||
|
|
|
@ -168,7 +168,9 @@
|
||||||
(if (and components-v2 (not (:deleted component)))
|
(if (and components-v2 (not (:deleted component)))
|
||||||
(let [component-page (get-component-page file-data component)]
|
(let [component-page (get-component-page file-data component)]
|
||||||
(when component-page
|
(when component-page
|
||||||
(ctn/get-shape component-page shape-id)))
|
(cfh/get-child (:objects component-page)
|
||||||
|
(:main-instance-id component)
|
||||||
|
shape-id)))
|
||||||
(dm/get-in component [:objects shape-id]))))
|
(dm/get-in component [:objects shape-id]))))
|
||||||
|
|
||||||
(defn get-ref-shape
|
(defn get-ref-shape
|
||||||
|
|
Loading…
Add table
Reference in a new issue