0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-08 13:01:24 -05:00

Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Alejandro Alonso 2025-03-14 12:55:44 +01:00
commit 66295b0adf
2 changed files with 20 additions and 14 deletions

View file

@ -1786,13 +1786,26 @@
(pcb/update-shapes
[shape-copy-id]
(fn [shape-copy objects]
(let [ids-map
(let [component-page
(ctf/get-component-page main-container main-component)
component-swap-children
(->> shape-main
:shapes
(map #(get (:objects component-page) %))
(filter #(some? (ctk/get-swap-slot %)))
(group-by ctk/get-swap-slot))
ids-map
(into {}
(comp
(map #(get objects %))
(keep
(fn [copy-shape]
(let [main-shape (ctf/get-ref-shape main-container main-component copy-shape)]
(let [main-shape
(if (some? (ctk/get-swap-slot copy-shape))
(first (get component-swap-children (ctk/get-swap-slot copy-shape)))
(ctf/get-ref-shape main-container main-component copy-shape))]
[(:id main-shape) (:id copy-shape)]))))
(:shapes shape-copy))
@ -1808,7 +1821,8 @@
main-cells (-> shape-main (ctl/remap-grid-cells ids-map) :layout-grid-cells)]
(-> shape-copy
(assoc :layout-grid-cells
(ctl/merge-cells copy-cells main-cells omit-touched?)))))
(ctl/merge-cells main-cells copy-cells omit-touched?))
(ctl/assign-cells objects))))
{:ignore-touched true :with-objects? true})))
(defn- update-grid-main-attrs

View file

@ -1643,15 +1643,10 @@
untouched as possible"
[target-cells source-cells omit-touched?]
(if omit-touched?
(letfn [(get-data [cells id]
(dissoc (get cells id) :row :column :row-span :column-span))
(merge-cells [source-cell target-cell]
(letfn [(merge-cells [source-cell target-cell]
(-> source-cell
(d/patch-object
(dissoc target-cell :shapes :row :column :row-span :column-span))
(cond-> (d/not-empty? (:shapes target-cell))
(assoc :shapes (:shapes target-cell)))))]
(dissoc target-cell :row :column :row-span :column-span))))]
(let [deleted-cells
(into #{}
(filter #(not (contains? source-cells %)))
@ -1659,10 +1654,7 @@
touched-cells
(into #{}
(filter #(and
(not (contains? deleted-cells %))
(not= (get-data source-cells %)
(get-data target-cells %))))
(filter #(not (contains? deleted-cells %)))
(keys target-cells))]
(->> touched-cells