mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 19:11:41 +02: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"}
|
[:map {:title "GroupAttrs"}
|
||||||
[:type [:= :group]]
|
[:type [:= :group]]
|
||||||
[:id ::sm/uuid]
|
[: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
|
(sm/def! ::frame-attrs
|
||||||
[:map {:title "FrameAttrs"}
|
[:map {:title "FrameAttrs"}
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
[:map {:title "BoolAttrs"}
|
[:map {:title "BoolAttrs"}
|
||||||
[:type [:= :bool]]
|
[:type [:= :bool]]
|
||||||
[:id ::sm/uuid]
|
[: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
|
;; FIXME: improve this schema
|
||||||
[:bool-type :keyword]
|
[:bool-type :keyword]
|
||||||
|
|
|
@ -1820,9 +1820,14 @@
|
||||||
detach? (or (foreign-instance? shape paste-objects state)
|
detach? (or (foreign-instance? shape paste-objects state)
|
||||||
(and (ctk/in-component-copy-not-root? shape)
|
(and (ctk/in-component-copy-not-root? shape)
|
||||||
(not= (:id component-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
|
(-> shape
|
||||||
(assoc :frame-id frame-id :parent-id parent-id)
|
(assoc :frame-id frame-id :parent-id parent-id)
|
||||||
|
(cond-> assign-shapes?
|
||||||
|
(assoc :shapes []))
|
||||||
(cond-> detach?
|
(cond-> detach?
|
||||||
(->
|
(->
|
||||||
;; this is used later, if the paste needs to create a new component from the detached shape
|
;; this is used later, if the paste needs to create a new component from the detached shape
|
||||||
|
|
|
@ -409,6 +409,8 @@
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(let [frame? (cph/frame-shape? obj)
|
(let [frame? (cph/frame-shape? obj)
|
||||||
|
group? (cph/group-shape? obj)
|
||||||
|
bool? (cph/bool-shape? obj)
|
||||||
new-id (ids-map (:id obj))
|
new-id (ids-map (:id obj))
|
||||||
parent-id (or parent-id frame-id)
|
parent-id (or parent-id frame-id)
|
||||||
name (:name obj)
|
name (:name obj)
|
||||||
|
@ -427,8 +429,12 @@
|
||||||
:name name
|
:name name
|
||||||
:parent-id parent-id
|
:parent-id parent-id
|
||||||
:frame-id frame-id)
|
:frame-id frame-id)
|
||||||
(dissoc :shapes
|
|
||||||
:main-instance?
|
(cond->
|
||||||
|
(or group? bool?)
|
||||||
|
(assoc :shapes []))
|
||||||
|
|
||||||
|
(dissoc :main-instance?
|
||||||
:use-for-thumbnail?)
|
:use-for-thumbnail?)
|
||||||
(gsh/move delta)
|
(gsh/move delta)
|
||||||
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)))
|
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue