diff --git a/CHANGES.md b/CHANGES.md index f80e97245..7482ad9c5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -130,6 +130,7 @@ - Fix problem with hand tool stuck [Github #3318](https://github.com/penpot/penpot/issues/3318) - Fix problem with fix scrolling on nested elements [Github #3508](https://github.com/penpot/penpot/issues/3508) - Fix problem when changing typography assets [Github #3683](https://github.com/penpot/penpot/issues/3683) +- Internal error when you copy and paste some main components between files [Taiga #7397](https://tree.taiga.io/project/penpot/issue/7397) ## 1.19.5 diff --git a/common/src/app/common/files/helpers.cljc b/common/src/app/common/files/helpers.cljc index d6a15fcd4..3856bc327 100644 --- a/common/src/app/common/files/helpers.cljc +++ b/common/src/app/common/files/helpers.cljc @@ -540,7 +540,10 @@ filted by selected set" [objects selected] (let [selected (if (set? selected) selected (set selected))] - (sequence (map val) (indexed-shapes objects selected)))) + (sequence + (comp (filter (fn [o] (contains? selected (val o)))) + (map val)) + (indexed-shapes objects selected)))) (defn get-index-replacement "Given a collection of shapes, calculate their positions diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 1dddf3f99..a6487e363 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -2041,7 +2041,6 @@ all-objects (merge page-objects objects) - drop-cell (when (ctl/grid-layout? all-objects parent-id) (gslg/get-drop-cell frame-id all-objects position)) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index acb0d2175..8ce2cfe1f 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -512,9 +512,11 @@ (ctk/remove-swap-slot)) (dissoc :shapes - :main-instance :use-for-thumbnail) + (cond-> (not is-component-root?) + (dissoc :main-instance)) + (cond-> into-component? (dissoc :component-root))