mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
🐛 Fix duplicate a component copy missing shape-ref
This commit is contained in:
parent
1106ebc377
commit
9b9f2c39b9
1 changed files with 12 additions and 7 deletions
|
@ -397,9 +397,9 @@
|
|||
|
||||
(defn- prepare-duplicate-shape-change
|
||||
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id]
|
||||
(prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj)))
|
||||
(prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj) false))
|
||||
|
||||
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id]
|
||||
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id duplicating-component?]
|
||||
(cond
|
||||
(nil? obj)
|
||||
changes
|
||||
|
@ -413,8 +413,9 @@
|
|||
parent-id (or parent-id frame-id)
|
||||
name (:name obj)
|
||||
|
||||
is-component-root? (:saved-component-root? obj)
|
||||
is-component-main? (:main-instance? obj)
|
||||
is-component-root? (or (:saved-component-root? obj) (ctk/instance-root? obj))
|
||||
duplicating-component? (or duplicating-component? is-component-root?)
|
||||
is-component-main? (ctk/main-instance? obj)
|
||||
regenerate-component
|
||||
(fn [changes shape]
|
||||
(let [components-v2 (dm/get-in library-data [:options :components-v2])
|
||||
|
@ -428,12 +429,15 @@
|
|||
:frame-id frame-id)
|
||||
(dissoc :shapes
|
||||
:main-instance?
|
||||
:shape-ref
|
||||
:use-for-thumbnail?)
|
||||
(gsh/move delta)
|
||||
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)))
|
||||
|
||||
changes (-> (pcb/add-object changes new-obj)
|
||||
new-obj (cond-> new-obj
|
||||
(not duplicating-component?)
|
||||
(dissoc :shape-ref))
|
||||
|
||||
changes (-> (pcb/add-object changes new-obj {:ignore-touched duplicating-component?})
|
||||
(pcb/amend-last-change #(assoc % :old-id (:id obj))))
|
||||
|
||||
changes (cond-> changes
|
||||
|
@ -454,7 +458,8 @@
|
|||
it
|
||||
file-id
|
||||
(if frame? new-id frame-id)
|
||||
new-id))
|
||||
new-id
|
||||
duplicating-component?))
|
||||
changes
|
||||
(map (d/getf objects) (:shapes obj)))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue