mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 05:27:17 +02:00
🐛 Fix on cut and paste a component, a bad frame-id is set
This commit is contained in:
parent
0370e8083a
commit
45072c19a2
2 changed files with 7 additions and 5 deletions
|
@ -247,9 +247,9 @@
|
||||||
(when (some #(= (:id current-page) %) (:pages library-data)) ;; If the page doesn't belong to the library, it's not valid
|
(when (some #(= (:id current-page) %) (:pages library-data)) ;; If the page doesn't belong to the library, it's not valid
|
||||||
current-page)
|
current-page)
|
||||||
(ctpl/get-last-page library-data))]
|
(ctpl/get-last-page library-data))]
|
||||||
(prepare-restore-component nil library-data component-id it page (gpt/point 0 0) nil nil)))
|
(prepare-restore-component nil library-data component-id it page (gpt/point 0 0) nil nil nil)))
|
||||||
|
|
||||||
([changes library-data component-id it page delta old-id parent-id]
|
([changes library-data component-id it page delta old-id parent-id frame-id]
|
||||||
(let [component (ctkl/get-deleted-component library-data component-id)
|
(let [component (ctkl/get-deleted-component library-data component-id)
|
||||||
parent (get-in page [:objects parent-id])
|
parent (get-in page [:objects parent-id])
|
||||||
inside-component? (some? (ctn/get-instance-root (:objects page) parent))
|
inside-component? (some? (ctn/get-instance-root (:objects page) parent))
|
||||||
|
@ -259,9 +259,11 @@
|
||||||
first-shape (cond-> (first shapes)
|
first-shape (cond-> (first shapes)
|
||||||
(not (nil? parent-id))
|
(not (nil? parent-id))
|
||||||
(assoc :parent-id parent-id)
|
(assoc :parent-id parent-id)
|
||||||
(and parent (= :frame (:type parent)))
|
(not (nil? frame-id))
|
||||||
|
(assoc :frame-id frame-id)
|
||||||
|
(and (nil? frame-id) parent (= :frame (:type parent)))
|
||||||
(assoc :frame-id parent-id)
|
(assoc :frame-id parent-id)
|
||||||
(and parent (not= :frame (:type parent)))
|
(and (nil? frame-id) parent (not= :frame (:type parent)))
|
||||||
(assoc :frame-id (:frame-id parent))
|
(assoc :frame-id (:frame-id parent))
|
||||||
inside-component?
|
inside-component?
|
||||||
(dissoc :component-root)
|
(dissoc :component-root)
|
||||||
|
|
|
@ -418,7 +418,7 @@
|
||||||
frame-id)
|
frame-id)
|
||||||
|
|
||||||
restore-component
|
restore-component
|
||||||
#(let [restore (dwlh/prepare-restore-component changes library-data (:component-id component-root) it page delta (:id component-root) parent-id)]
|
#(let [restore (dwlh/prepare-restore-component changes library-data (:component-id component-root) it page delta (:id component-root) parent-id frame-id)]
|
||||||
[(:shape restore) (:changes restore)])
|
[(:shape restore) (:changes restore)])
|
||||||
|
|
||||||
[_shape changes]
|
[_shape changes]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue