Add minor events props normalization (#6836)

This commit is contained in:
Andrey Antukh 2025-07-02 14:41:48 +02:00 committed by GitHub
parent e03c822b51
commit 898182e3d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 11 deletions

View file

@ -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)

View file

@ -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

View file

@ -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]