mirror of
https://github.com/penpot/penpot.git
synced 2025-05-09 01:35:54 +02:00
🐛 Fix problem when changing main component with grid elements
This commit is contained in:
parent
cea096f06c
commit
ace890c809
1 changed files with 12 additions and 0 deletions
|
@ -400,9 +400,21 @@
|
|||
:parent-id parent-id
|
||||
:frame-id frame-id)
|
||||
|
||||
:always
|
||||
;; Store in the meta the old id so we can do a remap afterwards
|
||||
;; in the parent
|
||||
(with-meta {::old-id (:id shape)})
|
||||
|
||||
(some? (:shapes shape))
|
||||
(assoc :shapes (mapv :id new-direct-children)))
|
||||
|
||||
;; For a GRID layout remap the cells shapes' old-id to the new id given in the clone
|
||||
new-shape
|
||||
(if (ctl/grid-layout? new-shape)
|
||||
(let [ids-map (into {} (map #(vector (-> % meta ::old-id) (:id %))) new-children)]
|
||||
(ctl/remap-grid-cells new-shape ids-map))
|
||||
new-shape)
|
||||
|
||||
new-shape (update-new-shape new-shape shape)
|
||||
new-shapes (into [new-shape] new-children)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue