From 2297862d81f8819688083fc2aebb7c433934941d Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Wed, 5 Mar 2025 11:18:30 +0100 Subject: [PATCH] :bug: Fix cut and paste a copy inside its parent --- CHANGES.md | 1 + common/src/app/common/types/container.cljc | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 4300daba95..7458d22ced 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ - Fix opacity in frame containers [Github #5858](https://github.com/penpot/penpot/pull/5858) - Avoid resizing on click [Taiga #10213](https://tree.taiga.io/project/penpot/issue/10213) - Hide horizontal scroll from dashboard sidebar [Taiga #10422](https://tree.taiga.io/project/penpot/issue/10422) +- Fix cut and paste a copy a cmponent inside its parent [Taiga #10365](https://tree.taiga.io/project/penpot/us/10365) ## 2.5.2 diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index 1a20994551..372b0ce1b0 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -501,7 +501,12 @@ (defn- invalid-structure-for-component? "Check if the structure generated nesting children in parent is invalid in terms of nested components" [objects parent children pasting? libraries] - (let [; When we are pasting, the main shapes will be pasted as copies, unless the + (let [; If the original shapes had been cutted, and we are pasting them now, they aren't + ; in objects. We can add them to locate later + objects (merge objects + (into {} (map (juxt :id identity) children))) + + ; When we are pasting, the main shapes will be pasted as copies, unless the ; original component doesn't exist or is deleted. So for this function purposes, they ; are removed from the list remove? (fn [shape]