0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 18:48:37 -05:00

🐛 Fix detach components with shortcut

This commit is contained in:
Alejandro Alonso 2024-02-23 12:19:37 +01:00 committed by Andrey Antukh
parent 8ea4e5ca10
commit 10d6f93ed7

View file

@ -618,11 +618,13 @@
(wsh/lookup-selected) (wsh/lookup-selected)
(cfh/clean-loops objects)) (cfh/clean-loops objects))
selected-objects (map #(get objects %) selected) selected-objects (map #(get objects %) selected)
can-detach? (every? #(not (ctn/has-any-copy-parent? objects %)) selected-objects) copies (filter ctk/in-component-copy? selected-objects)
can-detach? (and (seq copies)
(every? #(not (ctn/has-any-copy-parent? objects %)) selected-objects))
changes (when can-detach? changes (when can-detach?
(reduce (reduce
(fn [changes id] (fn [changes id]
(dwlh/generate-detach-instance changes libraries container id)) (dwlh/generate-detach-instance changes container libraries id))
(-> (pcb/empty-changes it) (-> (pcb/empty-changes it)
(pcb/with-container container) (pcb/with-container container)
(pcb/with-objects objects)) (pcb/with-objects objects))