diff --git a/CHANGES.md b/CHANGES.md index 75bdfabc6..f7796dab3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -55,6 +55,7 @@ is a number of cores) - Fix error when reseting stroke cap - Fix problem with strokes not refreshing in Safari [Taiga #9040](https://tree.taiga.io/project/penpot/issue/9040) - Fix problem with multiple color changes [Taiga #9631](https://tree.taiga.io/project/penpot/issue/9631) +- Fix create new layers in a component copy [Taiga #10037](https://tree.taiga.io/project/penpot/issue/10037) - Fix problem in plugins with zoomIntoView [Plugins #189](https://github.com/penpot/penpot-plugins/issues/189) - Fix problem in plugins with renaming components [Taiga #10060](https://tree.taiga.io/project/penpot/issue/10060) - Added upload svg with images method [#5489](https://github.com/penpot/penpot/issues/5489) diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index bdd62bcef..ae9ac3648 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -535,10 +535,11 @@ (letfn [(get-frame [parent-id] (if (cfh/frame-shape? objects parent-id) parent-id (get-in objects [parent-id :frame-id])))] (let [parent (get objects parent-id) - ;; We can always move the children to the parent they already have + ;; We can always move the children to the parent they already have. no-changes? (->> children (every? #(= parent-id (:parent-id %))))] - (if (or no-changes? (not (invalid-structure-for-component? objects parent children pasting? libraries))) + ;; In case no-changes is true we must ensure we are copy pasting the children in the same position + (if (or (and no-changes? (not pasting?)) (not (invalid-structure-for-component? objects parent children pasting? libraries))) [parent-id (get-frame parent-id)] (recur (:parent-id parent) objects children pasting? libraries))))))