mirror of
https://github.com/penpot/penpot.git
synced 2026-09-09 13:39:02 +00:00
🐛 Fix crash pressing Ctrl+D with no shape selected (#11491)
AI-assisted-by: claude-sonnet-5
This commit is contained in:
parent
214dbd0c8b
commit
064f200774
@ -539,9 +539,10 @@
|
|||||||
(let [objects (dsh/lookup-page-objects state)
|
(let [objects (dsh/lookup-page-objects state)
|
||||||
selected-ids (dsh/lookup-selected state)
|
selected-ids (dsh/lookup-selected state)
|
||||||
selected-shapes (map (d/getf objects) selected-ids)
|
selected-shapes (map (d/getf objects) selected-ids)
|
||||||
add-new-variant? (every? ctc/is-variant? selected-shapes)
|
add-new-variant? (and (seq selected-shapes) (every? ctc/is-variant? selected-shapes))
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
(if add-new-variant?
|
(cond
|
||||||
|
add-new-variant?
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(rx/of
|
(rx/of
|
||||||
(ev/event {::ev/name "add-new-variant" ::ev/origin "workspace:shortcut-duplicate"})
|
(ev/event {::ev/name "add-new-variant" ::ev/origin "workspace:shortcut-duplicate"})
|
||||||
@ -549,7 +550,12 @@
|
|||||||
(add-new-variant (first selected-ids) false))
|
(add-new-variant (first selected-ids) false))
|
||||||
(rx/from (map #(add-new-variant % true) (rest selected-ids)))
|
(rx/from (map #(add-new-variant % true) (rest selected-ids)))
|
||||||
(rx/of (dwu/commit-undo-transaction undo-id)))
|
(rx/of (dwu/commit-undo-transaction undo-id)))
|
||||||
(rx/of (dws/duplicate-selected true)))))))
|
|
||||||
|
(seq selected-ids)
|
||||||
|
(rx/of (dws/duplicate-selected true))
|
||||||
|
|
||||||
|
:else
|
||||||
|
(rx/empty))))))
|
||||||
|
|
||||||
(defn rename-variant
|
(defn rename-variant
|
||||||
"Rename the variant container and all components belonging to this variant"
|
"Rename the variant container and all components belonging to this variant"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user