mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 15:41:38 +02: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))))
|
(apply-changes-local))))
|
||||||
|
|
||||||
(defn add-component
|
(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-page-id changes)
|
||||||
(assert-objects changes)
|
(assert-objects changes)
|
||||||
(let [page-id (::page-id (meta changes))
|
(let [page-id (::page-id (meta changes))
|
||||||
|
@ -641,7 +643,8 @@
|
||||||
:path path
|
:path path
|
||||||
:name name
|
:name name
|
||||||
:main-instance-id main-instance-id
|
: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
|
(some? new-shapes) ;; this will be null in components-v2
|
||||||
(assoc :shapes (vec new-shapes))))
|
(assoc :shapes (vec new-shapes))))
|
||||||
(into (map mk-change) updated-shapes))))
|
(into (map mk-change) updated-shapes))))
|
||||||
|
@ -655,7 +658,7 @@
|
||||||
(map lookupf)
|
(map lookupf)
|
||||||
(map mk-change))
|
(map mk-change))
|
||||||
updated-shapes))))
|
updated-shapes))))
|
||||||
(apply-changes-local))))
|
(apply-changes-local)))))
|
||||||
|
|
||||||
(defn update-component
|
(defn update-component
|
||||||
[changes id update-fn]
|
[changes id update-fn]
|
||||||
|
|
|
@ -30,13 +30,12 @@
|
||||||
(assoc component :modified-at (dt/now)))
|
(assoc component :modified-at (dt/now)))
|
||||||
|
|
||||||
(defn add-component
|
(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])
|
(let [components-v2 (dm/get-in fdata [:options :components-v2])
|
||||||
fdata (update fdata :components assoc id (touch {:id id :name name :path path}))]
|
fdata (update fdata :components assoc id (touch {:id id :name name :path path}))]
|
||||||
(if components-v2
|
(if components-v2
|
||||||
(update-in fdata [:components id] assoc
|
(cond-> (update-in fdata [:components id] assoc :main-instance-id main-instance-id :main-instance-page main-instance-page)
|
||||||
:main-instance-id main-instance-id
|
annotation (update-in [:components id] assoc :annotation annotation))
|
||||||
:main-instance-page main-instance-page)
|
|
||||||
|
|
||||||
(let [wrap-object-fn feat/*wrap-with-objects-map-fn*]
|
(let [wrap-object-fn feat/*wrap-with-objects-map-fn*]
|
||||||
(assoc-in fdata [:components id :objects]
|
(assoc-in fdata [:components id :objects]
|
||||||
|
|
|
@ -423,7 +423,8 @@
|
||||||
new-component-shapes
|
new-component-shapes
|
||||||
[]
|
[]
|
||||||
(:id new-main-instance-shape)
|
(:id new-main-instance-shape)
|
||||||
(:id main-instance-page)))]
|
(:id main-instance-page)
|
||||||
|
(:annotation component)))]
|
||||||
|
|
||||||
(rx/of (dch/commit-changes changes))))))
|
(rx/of (dch/commit-changes changes))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue