mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 09:11:21 -05:00
🐛 Fix paste groups without shapes attr
This commit is contained in:
parent
30c786741f
commit
e7a82579c1
3 changed files with 16 additions and 5 deletions
|
@ -156,7 +156,7 @@
|
|||
[:map {:title "GroupAttrs"}
|
||||
[:type [:= :group]]
|
||||
[:id ::sm/uuid]
|
||||
[:shapes [:vector {:gen/max 10 :gen/min 1} ::sm/uuid]]])
|
||||
[:shapes {:optional true} [:maybe [:vector {:gen/max 10 :gen/min 1} ::sm/uuid]]]])
|
||||
|
||||
(sm/def! ::frame-attrs
|
||||
[:map {:title "FrameAttrs"}
|
||||
|
@ -172,7 +172,7 @@
|
|||
[:map {:title "BoolAttrs"}
|
||||
[:type [:= :bool]]
|
||||
[:id ::sm/uuid]
|
||||
[:shapes [:vector {:gen/max 10 :gen/min 1} ::sm/uuid]]
|
||||
[:shapes {:optional true} [:maybe [:vector {:gen/max 10 :gen/min 1} ::sm/uuid]]]
|
||||
|
||||
;; FIXME: improve this schema
|
||||
[:bool-type :keyword]
|
||||
|
|
|
@ -1820,9 +1820,14 @@
|
|||
detach? (or (foreign-instance? shape paste-objects state)
|
||||
(and (ctk/in-component-copy-not-root? shape)
|
||||
(not= (:id component-shape)
|
||||
(:id component-shape-parent))))]
|
||||
(:id component-shape-parent))))
|
||||
assign-shapes? (and (or (cph/group-shape? shape)
|
||||
(cph/bool-shape? shape))
|
||||
(nil? (:shapes shape)))]
|
||||
(-> shape
|
||||
(assoc :frame-id frame-id :parent-id parent-id)
|
||||
(cond-> assign-shapes?
|
||||
(assoc :shapes []))
|
||||
(cond-> detach?
|
||||
(->
|
||||
;; this is used later, if the paste needs to create a new component from the detached shape
|
||||
|
|
|
@ -409,6 +409,8 @@
|
|||
|
||||
:else
|
||||
(let [frame? (cph/frame-shape? obj)
|
||||
group? (cph/group-shape? obj)
|
||||
bool? (cph/bool-shape? obj)
|
||||
new-id (ids-map (:id obj))
|
||||
parent-id (or parent-id frame-id)
|
||||
name (:name obj)
|
||||
|
@ -427,8 +429,12 @@
|
|||
:name name
|
||||
:parent-id parent-id
|
||||
:frame-id frame-id)
|
||||
(dissoc :shapes
|
||||
:main-instance?
|
||||
|
||||
(cond->
|
||||
(or group? bool?)
|
||||
(assoc :shapes []))
|
||||
|
||||
(dissoc :main-instance?
|
||||
:use-for-thumbnail?)
|
||||
(gsh/move delta)
|
||||
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)))
|
||||
|
|
Loading…
Add table
Reference in a new issue