From 898182e3d507fbc192897ec349e74ee1ac40ba79 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 2 Jul 2025 14:41:48 +0200 Subject: [PATCH] :sparkles: Add minor events props normalization (#6836) --- frontend/src/app/main/data/workspace/clipboard.cljs | 9 +++++---- frontend/src/app/main/data/workspace/selection.cljs | 9 +++++---- frontend/src/app/main/data/workspace/shapes.cljs | 10 +++++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/main/data/workspace/clipboard.cljs b/frontend/src/app/main/data/workspace/clipboard.cljs index 448b8658ca..39efb0e616 100644 --- a/frontend/src/app/main/data/workspace/clipboard.cljs +++ b/frontend/src/app/main/data/workspace/clipboard.cljs @@ -909,16 +909,17 @@ (ev/event {::ev/name "use-library-component" ::ev/origin origin :is-external-library external-lib? - :parent-shape-type parent-type}) + :type (get shape :type) + :parent-type parent-type}) (if (cfh/has-layout? objects (:parent-id shape)) (ev/event {::ev/name "layout-add-element" ::ev/origin origin - :element-type (get shape :type) + :type (get shape :type) :parent-type parent-type}) (ev/event {::ev/name "create-shape" ::ev/origin origin - :shape-type (get shape :type) - :parent-shape-type parent-type}))))))) + :type (get shape :type) + :parent-type parent-type}))))))) (rx/of (dwu/start-undo-transaction undo-id) (dch/commit-changes changes) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 884f2e85d3..0ead5fd13d 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -493,16 +493,17 @@ (ev/event {::ev/name "use-library-component" ::ev/origin origin :is-external-library external-lib? - :parent-shape-type parent-type}) + :type (get shape :type) + :parent-type parent-type}) (if (cfh/has-layout? objects (:parent-id shape)) (ev/event {::ev/name "layout-add-element" ::ev/origin origin - :element-type (get shape :type) + :type (get shape :type) :parent-type parent-type}) (ev/event {::ev/name "create-shape" ::ev/origin origin - :shape-type (get shape :type) - :parent-shape-type parent-type}))))))) + :type (get shape :type) + :parent-type parent-type}))))))) ;; Warning: This order is important for the focus mode. (->> (rx/of diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index f755a3eb22..ad2bd88379 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -129,7 +129,10 @@ (pcb/set-undo-group (:id shape))) undo-id - (js/Symbol)] + (js/Symbol) + + parent-type + (cfh/get-shape-type objects (:parent-id shape))] (rx/concat (rx/of (dwu/start-undo-transaction undo-id) @@ -146,12 +149,13 @@ (rx/of (ev/event {::ev/name "create-shape" ::ev/origin "workspace:add-shape" :type (get shape :type) - :parent-type (cfh/get-shape-type objects (:parent-id shape))})) + :parent-type parent-type})) (when (cfh/has-layout? objects (:parent-id shape)) (rx/of (ev/event {::ev/name "layout-add-element" ::ev/origin "workspace:add-shape" - :element-type (get shape :type)}))))))))) + :type (get shape :type) + :parent-type parent-type}))))))))) (defn move-shapes-into-frame [frame-id shapes]