mirror of
https://github.com/penpot/penpot.git
synced 2025-03-16 01:31:22 -05:00
🎉 Open file in a new tab
This commit is contained in:
parent
e87dc6d34c
commit
d1261fc841
3 changed files with 26 additions and 8 deletions
|
@ -579,6 +579,13 @@
|
|||
},
|
||||
"used-in" : [ "src/app/main/ui/dashboard/team.cljs" ]
|
||||
},
|
||||
"dashboard.open-in-new-tab" : {
|
||||
"translations" : {
|
||||
"en" : "Open file in a new tab",
|
||||
"es" : "Abrir en una pestaña nueva"
|
||||
},
|
||||
"used-in" : [ "src/app/main/ui/dashboard/file_menu.cljs" ]
|
||||
},
|
||||
"dashboard.password-change" : {
|
||||
"translations" : {
|
||||
"ca" : "Canvia la contrasenya",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
[app.main.ui.components.context-menu :refer [context-menu]]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[rumext.alpha :as mf]))
|
||||
|
||||
(mf/defc file-menu
|
||||
|
@ -26,6 +27,15 @@
|
|||
(let [top (or top 0)
|
||||
left (or left 0)
|
||||
|
||||
on-new-tab
|
||||
(mf/use-callback
|
||||
(mf/deps file)
|
||||
(fn [event]
|
||||
(let [pparams {:project-id (:project-id file)
|
||||
:file-id (:id file)}
|
||||
qparams {:page-id (first (get-in file [:data :pages]))}]
|
||||
(st/emit! (rt/nav-new-window :workspace pparams qparams)))))
|
||||
|
||||
delete-fn
|
||||
(mf/use-callback
|
||||
(mf/deps file)
|
||||
|
@ -88,7 +98,8 @@
|
|||
:fixed? (or (not= top 0) (not= left 0))
|
||||
:top top
|
||||
:left left
|
||||
:options [[(tr "labels.rename") on-edit]
|
||||
:options [[(tr "dashboard.open-in-new-tab") on-new-tab]
|
||||
[(tr "labels.rename") on-edit]
|
||||
[(tr "labels.delete") on-delete]
|
||||
(if (:is-shared file)
|
||||
[(tr "dashboard.remove-shared") on-del-shared]
|
||||
|
|
|
@ -126,13 +126,13 @@
|
|||
[:div.project-th-icon.menu
|
||||
{:ref menu-ref
|
||||
:on-click on-menu-click}
|
||||
i/actions]]
|
||||
[:& file-menu {:file file
|
||||
:show? (:menu-open @local)
|
||||
:left (:x (:menu-pos @local))
|
||||
:top (:y (:menu-pos @local))
|
||||
:on-edit on-edit
|
||||
:on-menu-close on-menu-close}]]))
|
||||
i/actions
|
||||
[:& file-menu {:file file
|
||||
:show? (:menu-open @local)
|
||||
:left (:x (:menu-pos @local))
|
||||
:top (:y (:menu-pos @local))
|
||||
:on-edit on-edit
|
||||
:on-menu-close on-menu-close}]]]]))
|
||||
|
||||
(mf/defc empty-placeholder
|
||||
[]
|
||||
|
|
Loading…
Add table
Reference in a new issue