mirror of
https://github.com/penpot/penpot.git
synced 2025-01-07 15:39:42 -05:00
🎉 Rename selected layer via shortcut and context menu option
This commit is contained in:
parent
b86f2ba90d
commit
48c41df054
6 changed files with 42 additions and 1 deletions
|
@ -17,9 +17,11 @@
|
|||
|
||||
- Viewer role for team members [Taiga #1056 & #6590](https://tree.taiga.io/project/penpot/us/1056 & https://tree.taiga.io/project/penpot/us/6590)
|
||||
- File history versions management [Taiga](https://tree.taiga.io/project/penpot/us/187?milestone=411120)
|
||||
- Rename selected layer via keyboard shortcut and context menu option [Taiga #8882](https://tree.taiga.io/project/penpot/us/8882)
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
|
||||
## 2.3.1
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
|
||||
(declare ^:private workspace-initialized)
|
||||
(declare ^:private libraries-fetched)
|
||||
(declare go-to-layout)
|
||||
|
||||
;; --- Initialize Workspace
|
||||
|
||||
|
@ -810,6 +811,21 @@
|
|||
(d/not-empty? hover-guides)
|
||||
(rx/of (dwgu/remove-guides hover-guides)))))))
|
||||
|
||||
|
||||
;; --- Start renaming selected shape
|
||||
|
||||
(defn start-rename-selected
|
||||
"Rename selected shape."
|
||||
[]
|
||||
(ptk/reify ::start-rename-selected
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [selected (wsh/lookup-selected state)
|
||||
id (first selected)]
|
||||
(when (= (count selected) 1)
|
||||
(rx/of (go-to-layout :layers)
|
||||
(start-rename-shape id)))))))
|
||||
|
||||
;; --- Shape Vertical Ordering
|
||||
|
||||
(def valid-vertical-locations
|
||||
|
|
|
@ -129,9 +129,12 @@
|
|||
:subsections [:edit]
|
||||
:fn #(st/emit! esc-pressed)}
|
||||
|
||||
|
||||
;; MODIFY LAYERS
|
||||
|
||||
:rename {:tooltip (ds/alt "N")
|
||||
:command "alt+n"
|
||||
:subsections [:edit]
|
||||
:fn #(emit-when-no-readonly (dw/start-rename-selected))}
|
||||
|
||||
:group {:tooltip (ds/meta "G")
|
||||
:command (ds/c-mod "g")
|
||||
|
|
|
@ -226,6 +226,16 @@
|
|||
:on-click do-toggle-thumbnail}])
|
||||
[:& menu-separator]])))
|
||||
|
||||
(mf/defc context-menu-rename
|
||||
[{:keys [shapes]}]
|
||||
(let [do-rename #(st/emit! (dw/start-rename-selected))]
|
||||
(when (= (count shapes) 1)
|
||||
[:*
|
||||
[:& menu-separator]
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.rename")
|
||||
:shortcut (sc/get-tooltip :rename)
|
||||
:on-click do-rename}]])))
|
||||
|
||||
(mf/defc context-menu-group
|
||||
[{:keys [shapes]}]
|
||||
|
||||
|
@ -501,6 +511,7 @@
|
|||
[:> context-menu-layer-position props]
|
||||
[:> context-menu-flip props]
|
||||
[:> context-menu-thumbnail props]
|
||||
[:> context-menu-rename props]
|
||||
[:> context-menu-group props]
|
||||
[:> context-focus-mode-menu props]
|
||||
[:> context-menu-path props]
|
||||
|
|
|
@ -5956,6 +5956,10 @@ msgstr "Bring to front"
|
|||
msgid "workspace.shape.menu.go-main"
|
||||
msgstr "Go to main component file"
|
||||
|
||||
#: src/app/main/ui/workspace/context_menu.cljs:234
|
||||
msgid "workspace.shape.menu.rename"
|
||||
msgstr "Rename"
|
||||
|
||||
#: src/app/main/ui/workspace/context_menu.cljs:261
|
||||
msgid "workspace.shape.menu.group"
|
||||
msgstr "Group"
|
||||
|
|
|
@ -5934,6 +5934,11 @@ msgstr "Mover al frente"
|
|||
msgid "workspace.shape.menu.go-main"
|
||||
msgstr "Ir al archivo del componente principal"
|
||||
|
||||
#: src/app/main/ui/workspace/context_menu.cljs:234
|
||||
msgid "workspace.shape.menu.rename"
|
||||
msgstr "Renombrar"
|
||||
|
||||
|
||||
#: src/app/main/ui/workspace/context_menu.cljs:261
|
||||
msgid "workspace.shape.menu.group"
|
||||
msgstr "Agrupar"
|
||||
|
|
Loading…
Reference in a new issue