Merge pull request #4254 from penpot/palba-fix-crash-copy

🐛 Fix crash copy paste a Copy from a library
This commit is contained in:
Alejandro 2024-03-13 10:01:58 +01:00 committed by GitHub
commit ecb8ed8b8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View file

@ -468,7 +468,7 @@
(nil? obj)
changes
(ctf/is-known-component? obj libraries)
(ctf/is-main-of-known-component? obj libraries)
(prepare-duplicate-component-change changes objects page obj parent-id frame-id delta libraries library-data it)
:else
@ -486,6 +486,9 @@
(ctk/instance-root? obj))
duplicating-component? (or duplicating-component? (ctk/instance-head? obj))
is-component-main? (ctk/main-instance? obj)
original-ref-shape (-> (ctf/find-original-ref-shape nil page libraries obj {:include-deleted? true})
:id)
into-component? (and duplicating-component?
(ctn/in-any-component? objects parent))
@ -516,6 +519,10 @@
(cond-> (or frame? group? bool?)
(assoc :shapes []))
(cond-> (and (some? original-ref-shape)
(not= original-ref-shape (:shape-ref obj)))
(assoc :shape-ref original-ref-shape))
(gsh/move delta)
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects))