mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 00:01:51 -05:00
🎉 Add shortut Ctrl+Shift+K to detach instances
This commit is contained in:
parent
10db35eab4
commit
63259b3f92
4 changed files with 32 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
- Allow to zoom with ctrl + middle button [Taiga #1428](https://tree.taiga.io/project/penpot/us/1428).
|
||||
- Auto placement of duplicated objects [Taiga #1386](https://tree.taiga.io/project/penpot/us/1386).
|
||||
- Go to a undo step clicking on a history element of the list [Taiga #1374](https://tree.taiga.io/project/penpot/us/1374).
|
||||
- New shortcut to detach components Ctrl+Shift+K [Taiga #1799](https://tree.taiga.io/project/penpot/us/1799).
|
||||
- Set email inputs to type "email", to aid keyboard entry [Taiga #1921](https://tree.taiga.io/project/penpot/issue/1921).
|
||||
- Use space + mouse drag to pan, instead of only space [Taiga #1800](https://tree.taiga.io/project/penpot/us/1800).
|
||||
|
||||
|
|
|
@ -462,6 +462,31 @@
|
|||
:undo-changes uchanges
|
||||
:origin it}))))))
|
||||
|
||||
(def detach-selected-components
|
||||
(ptk/reify ::detach-selected-components
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
local-library (dwlh/get-local-file state)
|
||||
container (cp/get-container page-id :page local-library)
|
||||
|
||||
selected (->> state
|
||||
(wsh/lookup-selected)
|
||||
(cp/clean-loops objects))
|
||||
|
||||
[rchanges uchanges]
|
||||
(reduce (fn [changes id]
|
||||
(dwlh/concat-changes
|
||||
changes
|
||||
(dwlh/generate-detach-instance id container)))
|
||||
dwlh/empty-changes
|
||||
selected)]
|
||||
|
||||
(rx/of (dch/commit-changes {:redo-changes rchanges
|
||||
:undo-changes uchanges
|
||||
:origin it}))))))
|
||||
|
||||
(defn nav-to-component-file
|
||||
[file-id]
|
||||
(us/assert ::us/uuid file-id)
|
||||
|
|
|
@ -93,6 +93,10 @@
|
|||
:command (ds/c-mod "k")
|
||||
:fn #(st/emit! dwl/add-component)}
|
||||
|
||||
:detach-component {:tooltip (ds/meta-shift "K")
|
||||
:command (ds/c-mod "shift+k")
|
||||
:fn #(st/emit! dwl/detach-selected-components)}
|
||||
|
||||
:flip-vertical {:tooltip (ds/shift "V")
|
||||
:command "shift+v"
|
||||
:fn #(st/emit! (dw/flip-vertical-selected))}
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
[:*
|
||||
[:& menu-separator]
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instance")
|
||||
:shortcut (sc/get-tooltip :detach-component)
|
||||
:on-click do-detach-component}]
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
||||
:on-click do-reset-component}]
|
||||
|
@ -205,6 +206,7 @@
|
|||
[:*
|
||||
[:& menu-separator]
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.detach-instance")
|
||||
:shortcut (sc/get-tooltip :detach-component)
|
||||
:on-click do-detach-component}]
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides")
|
||||
:on-click do-reset-component}]
|
||||
|
|
Loading…
Add table
Reference in a new issue