🐛 Fix token unset when flex layout is applied

This commit is contained in:
Eva Marco 2025-03-12 16:34:30 +01:00 committed by Andrés Moya
parent 2fe6fb28e4
commit 21b2c0c26a
2 changed files with 5 additions and 4 deletions

View file

@ -38,7 +38,7 @@
[shape changes])) [shape changes]))
(defn prepare-move-shapes-into-frame (defn prepare-move-shapes-into-frame
[changes frame-id shapes objects] [changes frame-id shapes objects remove-layout-data?]
(let [parent-id (dm/get-in objects [frame-id :parent-id]) (let [parent-id (dm/get-in objects [frame-id :parent-id])
shapes (remove #(= % parent-id) shapes) shapes (remove #(= % parent-id) shapes)
to-move (->> shapes to-move (->> shapes
@ -46,7 +46,8 @@
(not-empty))] (not-empty))]
(if to-move (if to-move
(-> changes (-> changes
(cond-> (not (ctl/any-layout? objects frame-id)) (cond-> (and remove-layout-data?
(not (ctl/any-layout? objects frame-id)))
(pcb/update-shapes shapes ctl/remove-layout-item-data)) (pcb/update-shapes shapes ctl/remove-layout-item-data))
(pcb/update-shapes shapes #(cond-> % (cfh/frame-shape? %) (assoc :hide-in-viewer true))) (pcb/update-shapes shapes #(cond-> % (cfh/frame-shape? %) (assoc :hide-in-viewer true)))
(pcb/change-parent frame-id to-move 0) (pcb/change-parent frame-id to-move 0)
@ -133,7 +134,7 @@
(prepare-add-shape changes shape objects) (prepare-add-shape changes shape objects)
changes changes
(prepare-move-shapes-into-frame changes (:id shape) selected' objects) (prepare-move-shapes-into-frame changes (:id shape) selected' objects false)
changes changes
(cond-> changes (cond-> changes

View file

@ -150,7 +150,7 @@
changes (-> (pcb/empty-changes it page-id) changes (-> (pcb/empty-changes it page-id)
(pcb/with-objects objects)) (pcb/with-objects objects))
changes (cfsh/prepare-move-shapes-into-frame changes frame-id shapes objects)] changes (cfsh/prepare-move-shapes-into-frame changes frame-id shapes objects true)]
(if (some? changes) (if (some? changes)
(rx/of (dch/commit-changes changes)) (rx/of (dch/commit-changes changes))