mirror of
https://github.com/penpot/penpot.git
synced 2025-07-19 14:57:20 +02:00
✨ Add shortcuts to viewer btns
This commit is contained in:
parent
771bb20976
commit
f3548aff8c
8 changed files with 60 additions and 53 deletions
|
@ -549,10 +549,12 @@
|
||||||
(ptk/reify ::go-to-workspace
|
(ptk/reify ::go-to-workspace
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [project-id (get-in state [:viewer :project :id])
|
(let [route (:route state)
|
||||||
|
project-id (get-in state [:viewer :project :id])
|
||||||
file-id (get-in state [:viewer :file :id])
|
file-id (get-in state [:viewer :file :id])
|
||||||
|
saved-page-id (get-in route [:query-params :page-id])
|
||||||
pparams {:project-id project-id :file-id file-id}
|
pparams {:project-id project-id :file-id file-id}
|
||||||
qparams {:page-id (or page-id (:current-page-id state))}]
|
qparams {:page-id (or page-id saved-page-id)}]
|
||||||
(rx/of (rt/nav-new-window*
|
(rx/of (rt/nav-new-window*
|
||||||
{:rname :workspace
|
{:rname :workspace
|
||||||
:path-params pparams
|
:path-params pparams
|
||||||
|
|
|
@ -11,49 +11,53 @@
|
||||||
[app.main.store :as st]))
|
[app.main.store :as st]))
|
||||||
|
|
||||||
(def shortcuts
|
(def shortcuts
|
||||||
{:increase-zoom {:tooltip "+"
|
{:increase-zoom {:tooltip "+"
|
||||||
:command "+"
|
:command "+"
|
||||||
:fn (st/emitf dv/increase-zoom)}
|
:fn (st/emitf dv/increase-zoom)}
|
||||||
|
|
||||||
:decrease-zoom {:tooltip "-"
|
:decrease-zoom {:tooltip "-"
|
||||||
:command "-"
|
:command "-"
|
||||||
:fn (st/emitf dv/decrease-zoom)}
|
:fn (st/emitf dv/decrease-zoom)}
|
||||||
|
|
||||||
:select-all {:tooltip (ds/meta "A")
|
:select-all {:tooltip (ds/meta "A")
|
||||||
:command (ds/c-mod "a")
|
:command (ds/c-mod "a")
|
||||||
:fn (st/emitf (dv/select-all))}
|
:fn (st/emitf (dv/select-all))}
|
||||||
|
|
||||||
:zoom-50 {:tooltip (ds/shift "0")
|
:zoom-50 {:tooltip (ds/shift "0")
|
||||||
:command "shift+0"
|
:command "shift+0"
|
||||||
:fn (st/emitf dv/zoom-to-50)}
|
:fn (st/emitf dv/zoom-to-50)}
|
||||||
|
|
||||||
:reset-zoom {:tooltip (ds/shift "1")
|
:reset-zoom {:tooltip (ds/shift "1")
|
||||||
:command "shift+1"
|
:command "shift+1"
|
||||||
:fn (st/emitf dv/reset-zoom)}
|
:fn (st/emitf dv/reset-zoom)}
|
||||||
|
|
||||||
:zoom-200 {:tooltip (ds/shift "2")
|
:zoom-200 {:tooltip (ds/shift "2")
|
||||||
:command "shift+2"
|
:command "shift+2"
|
||||||
:fn (st/emitf dv/zoom-to-200)}
|
:fn (st/emitf dv/zoom-to-200)}
|
||||||
|
|
||||||
:next-frame {:tooltip ds/left-arrow
|
:next-frame {:tooltip ds/left-arrow
|
||||||
:command "left"
|
:command "left"
|
||||||
:fn (st/emitf dv/select-prev-frame)}
|
:fn (st/emitf dv/select-prev-frame)}
|
||||||
|
|
||||||
:prev-frame {:tooltip ds/right-arrow
|
:prev-frame {:tooltip ds/right-arrow
|
||||||
:command "right"
|
:command "right"
|
||||||
:fn (st/emitf dv/select-next-frame)}
|
:fn (st/emitf dv/select-next-frame)}
|
||||||
|
|
||||||
:open-handoff {:tooltip "G H"
|
:open-handoff {:tooltip "G H"
|
||||||
:command "g h"
|
:command "g h"
|
||||||
:fn #(st/emit! (dv/go-to-section :handoff))}
|
:fn #(st/emit! (dv/go-to-section :handoff))}
|
||||||
|
|
||||||
:open-comments {:tooltip "G C"
|
:open-comments {:tooltip "G C"
|
||||||
:command "g c"
|
:command "g c"
|
||||||
:fn #(st/emit! (dv/go-to-section :comments))}
|
:fn #(st/emit! (dv/go-to-section :comments))}
|
||||||
|
|
||||||
:open-workspace {:tooltip "G W"
|
:open-interactions {:tooltip "G V"
|
||||||
:command "g w"
|
:command "g v"
|
||||||
:fn #(st/emit! (dv/go-to-workspace))}})
|
:fn #(st/emit! (dv/go-to-section :interactions))}
|
||||||
|
|
||||||
|
:open-workspace {:tooltip "G W"
|
||||||
|
:command "g w"
|
||||||
|
:fn #(st/emit! (dv/go-to-workspace))}})
|
||||||
|
|
||||||
(defn get-tooltip [shortcut]
|
(defn get-tooltip [shortcut]
|
||||||
(assert (contains? shortcuts shortcut) (str shortcut))
|
(assert (contains? shortcuts shortcut) (str shortcut))
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
(:require
|
(:require
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.data.viewer :as dv]
|
[app.main.data.viewer :as dv]
|
||||||
|
[app.main.data.viewer.shortcuts :as sc]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.dropdown :refer [dropdown]]
|
[app.main.ui.components.dropdown :refer [dropdown]]
|
||||||
[app.main.ui.components.fullscreen :as fs]
|
[app.main.ui.components.fullscreen :as fs]
|
||||||
|
@ -151,14 +152,14 @@
|
||||||
[:button.mode-zone-button.tooltip.tooltip-bottom
|
[:button.mode-zone-button.tooltip.tooltip-bottom
|
||||||
{:on-click #(navigate :interactions)
|
{:on-click #(navigate :interactions)
|
||||||
:class (dom/classnames :active (= section :interactions))
|
:class (dom/classnames :active (= section :interactions))
|
||||||
:alt (tr "viewer.header.interactions-section")}
|
:alt (tr "viewer.header.interactions-section" (sc/get-tooltip :open-interactions))}
|
||||||
i/play]
|
i/play]
|
||||||
|
|
||||||
(when (:can-edit permissions)
|
(when (:can-edit permissions)
|
||||||
[:button.mode-zone-button.tooltip.tooltip-bottom
|
[:button.mode-zone-button.tooltip.tooltip-bottom
|
||||||
{:on-click #(navigate :comments)
|
{:on-click #(navigate :comments)
|
||||||
:class (dom/classnames :active (= section :comments))
|
:class (dom/classnames :active (= section :comments))
|
||||||
:alt (tr "viewer.header.comments-section")}
|
:alt (tr "viewer.header.comments-section" (sc/get-tooltip :open-comments))}
|
||||||
i/chat])
|
i/chat])
|
||||||
|
|
||||||
(when (or (= (:type permissions) :membership)
|
(when (or (= (:type permissions) :membership)
|
||||||
|
@ -167,7 +168,7 @@
|
||||||
[:button.mode-zone-button.tooltip.tooltip-bottom
|
[:button.mode-zone-button.tooltip.tooltip-bottom
|
||||||
{:on-click #(navigate :handoff)
|
{:on-click #(navigate :handoff)
|
||||||
:class (dom/classnames :active (= section :handoff))
|
:class (dom/classnames :active (= section :handoff))
|
||||||
:alt (tr "viewer.header.handsoff-section")}
|
:alt (tr "viewer.header.handsoff-section" (sc/get-tooltip :open-handoff))}
|
||||||
i/code])]
|
i/code])]
|
||||||
|
|
||||||
[:& header-options {:section section
|
[:& header-options {:section section
|
||||||
|
|
|
@ -1708,7 +1708,7 @@ msgid "viewer.frame-not-found"
|
||||||
msgstr "No s'ha trobat la taula de treball."
|
msgstr "No s'ha trobat la taula de treball."
|
||||||
|
|
||||||
msgid "viewer.header.comments-section"
|
msgid "viewer.header.comments-section"
|
||||||
msgstr "Comentaris"
|
msgstr "Comentaris (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.dont-show-interactions"
|
msgid "viewer.header.dont-show-interactions"
|
||||||
|
@ -1723,14 +1723,14 @@ msgid "viewer.header.fullscreen"
|
||||||
msgstr "Pantalla completa"
|
msgstr "Pantalla completa"
|
||||||
|
|
||||||
msgid "viewer.header.handsoff-section"
|
msgid "viewer.header.handsoff-section"
|
||||||
msgstr "Lliurament"
|
msgstr "Lliurament (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.interactions"
|
msgid "viewer.header.interactions"
|
||||||
msgstr "Interaccions"
|
msgstr "Interaccions"
|
||||||
|
|
||||||
msgid "viewer.header.interactions-section"
|
msgid "viewer.header.interactions-section"
|
||||||
msgstr "Interaccions"
|
msgstr "Interaccions (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.share.copy-link"
|
msgid "viewer.header.share.copy-link"
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ msgid "viewer.frame-not-found"
|
||||||
msgstr "Keine Zeichenfläche gefunden."
|
msgstr "Keine Zeichenfläche gefunden."
|
||||||
|
|
||||||
msgid "viewer.header.comments-section"
|
msgid "viewer.header.comments-section"
|
||||||
msgstr "Kommentare"
|
msgstr "Kommentare (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.dont-show-interactions"
|
msgid "viewer.header.dont-show-interactions"
|
||||||
|
@ -1768,14 +1768,14 @@ msgid "viewer.header.fullscreen"
|
||||||
msgstr "Vollbildmodus"
|
msgstr "Vollbildmodus"
|
||||||
|
|
||||||
msgid "viewer.header.handsoff-section"
|
msgid "viewer.header.handsoff-section"
|
||||||
msgstr "Übergabe"
|
msgstr "Übergabe (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.interactions"
|
msgid "viewer.header.interactions"
|
||||||
msgstr "Interaktionen"
|
msgstr "Interaktionen"
|
||||||
|
|
||||||
msgid "viewer.header.interactions-section"
|
msgid "viewer.header.interactions-section"
|
||||||
msgstr "Interaktionen"
|
msgstr "Interaktionen (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.share.copy-link"
|
msgid "viewer.header.share.copy-link"
|
||||||
|
|
|
@ -1757,7 +1757,7 @@ msgid "viewer.frame-not-found"
|
||||||
msgstr "Artboard not found."
|
msgstr "Artboard not found."
|
||||||
|
|
||||||
msgid "viewer.header.comments-section"
|
msgid "viewer.header.comments-section"
|
||||||
msgstr "Comments"
|
msgstr "Comments (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.dont-show-interactions"
|
msgid "viewer.header.dont-show-interactions"
|
||||||
|
@ -1768,14 +1768,14 @@ msgid "viewer.header.fullscreen"
|
||||||
msgstr "Full Screen"
|
msgstr "Full Screen"
|
||||||
|
|
||||||
msgid "viewer.header.handsoff-section"
|
msgid "viewer.header.handsoff-section"
|
||||||
msgstr "Handsoff"
|
msgstr "Handsoff (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.interactions"
|
msgid "viewer.header.interactions"
|
||||||
msgstr "Interactions"
|
msgstr "Interactions"
|
||||||
|
|
||||||
msgid "viewer.header.interactions-section"
|
msgid "viewer.header.interactions-section"
|
||||||
msgstr "Interactions"
|
msgstr "Interactions (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.share.copy-link"
|
msgid "viewer.header.share.copy-link"
|
||||||
|
|
|
@ -1756,7 +1756,7 @@ msgid "viewer.frame-not-found"
|
||||||
msgstr "No se encuentra el tablero."
|
msgstr "No se encuentra el tablero."
|
||||||
|
|
||||||
msgid "viewer.header.comments-section"
|
msgid "viewer.header.comments-section"
|
||||||
msgstr "Comentarios"
|
msgstr "Comentarios (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.dont-show-interactions"
|
msgid "viewer.header.dont-show-interactions"
|
||||||
|
@ -1767,14 +1767,14 @@ msgid "viewer.header.fullscreen"
|
||||||
msgstr "Pantalla completa"
|
msgstr "Pantalla completa"
|
||||||
|
|
||||||
msgid "viewer.header.handsoff-section"
|
msgid "viewer.header.handsoff-section"
|
||||||
msgstr "Handoff"
|
msgstr "Handoff (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.interactions"
|
msgid "viewer.header.interactions"
|
||||||
msgstr "Interacciones"
|
msgstr "Interacciones"
|
||||||
|
|
||||||
msgid "viewer.header.interactions-section"
|
msgid "viewer.header.interactions-section"
|
||||||
msgstr "Interacciones"
|
msgstr "Interacciones (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.share.copy-link"
|
msgid "viewer.header.share.copy-link"
|
||||||
|
|
|
@ -1732,7 +1732,7 @@ msgid "viewer.frame-not-found"
|
||||||
msgstr "Çalışma yüzeyi bulunamadı."
|
msgstr "Çalışma yüzeyi bulunamadı."
|
||||||
|
|
||||||
msgid "viewer.header.comments-section"
|
msgid "viewer.header.comments-section"
|
||||||
msgstr "Yorumlar"
|
msgstr "Yorumlar (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.dont-show-interactions"
|
msgid "viewer.header.dont-show-interactions"
|
||||||
|
@ -1755,7 +1755,7 @@ msgid "viewer.header.interactions"
|
||||||
msgstr "Etkileşimler"
|
msgstr "Etkileşimler"
|
||||||
|
|
||||||
msgid "viewer.header.interactions-section"
|
msgid "viewer.header.interactions-section"
|
||||||
msgstr "Etkileşimler"
|
msgstr "Etkileşimler (%s)"
|
||||||
|
|
||||||
#: src/app/main/ui/viewer/header.cljs
|
#: src/app/main/ui/viewer/header.cljs
|
||||||
msgid "viewer.header.share.copy-link"
|
msgid "viewer.header.share.copy-link"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue