mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
🐛 Fix annotation is not duplicated together with main component
This commit is contained in:
parent
0ae4988908
commit
54cee6ea72
3 changed files with 11 additions and 8 deletions
|
@ -603,7 +603,9 @@
|
|||
(apply-changes-local))))
|
||||
|
||||
(defn add-component
|
||||
[changes id path name new-shapes updated-shapes main-instance-id main-instance-page]
|
||||
([changes id path name new-shapes updated-shapes main-instance-id main-instance-page]
|
||||
(add-component changes id path name new-shapes updated-shapes main-instance-id main-instance-page nil))
|
||||
([changes id path name new-shapes updated-shapes main-instance-id main-instance-page annotation]
|
||||
(assert-page-id changes)
|
||||
(assert-objects changes)
|
||||
(let [page-id (::page-id (meta changes))
|
||||
|
@ -641,7 +643,8 @@
|
|||
:path path
|
||||
:name name
|
||||
:main-instance-id main-instance-id
|
||||
:main-instance-page main-instance-page}
|
||||
:main-instance-page main-instance-page
|
||||
:annotation annotation}
|
||||
(some? new-shapes) ;; this will be null in components-v2
|
||||
(assoc :shapes (vec new-shapes))))
|
||||
(into (map mk-change) updated-shapes))))
|
||||
|
@ -655,7 +658,7 @@
|
|||
(map lookupf)
|
||||
(map mk-change))
|
||||
updated-shapes))))
|
||||
(apply-changes-local))))
|
||||
(apply-changes-local)))))
|
||||
|
||||
(defn update-component
|
||||
[changes id update-fn]
|
||||
|
|
|
@ -30,13 +30,12 @@
|
|||
(assoc component :modified-at (dt/now)))
|
||||
|
||||
(defn add-component
|
||||
[fdata {:keys [id name path main-instance-id main-instance-page shapes]}]
|
||||
[fdata {:keys [id name path main-instance-id main-instance-page shapes annotation]}]
|
||||
(let [components-v2 (dm/get-in fdata [:options :components-v2])
|
||||
fdata (update fdata :components assoc id (touch {:id id :name name :path path}))]
|
||||
(if components-v2
|
||||
(update-in fdata [:components id] assoc
|
||||
:main-instance-id main-instance-id
|
||||
:main-instance-page main-instance-page)
|
||||
(cond-> (update-in fdata [:components id] assoc :main-instance-id main-instance-id :main-instance-page main-instance-page)
|
||||
annotation (update-in [:components id] assoc :annotation annotation))
|
||||
|
||||
(let [wrap-object-fn feat/*wrap-with-objects-map-fn*]
|
||||
(assoc-in fdata [:components id :objects]
|
||||
|
|
|
@ -423,7 +423,8 @@
|
|||
new-component-shapes
|
||||
[]
|
||||
(:id new-main-instance-shape)
|
||||
(:id main-instance-page)))]
|
||||
(:id main-instance-page)
|
||||
(:annotation component)))]
|
||||
|
||||
(rx/of (dch/commit-changes changes))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue