Browse Source

feat: shift click a repo name to open it in new window

Peng Xiao 3 năm trước cách đây
mục cha
commit
3fc2259b51

+ 6 - 2
src/main/frontend/components/repo.cljs

@@ -24,7 +24,8 @@
             [frontend.mobile.util :as mobile-util]
             [frontend.text :as text]
             [promesa.core :as p]
-            [electron.ipc :as ipc]))
+            [electron.ipc :as ipc]
+            [goog.object :as gobj]))
 
 (rum/defc add-repo
   [args]
@@ -211,7 +212,10 @@
                             {:title short-repo-name
                              :hover-detail repo-path ;; show full path on hover
                              :options {:class "ml-1"
-                                       :on-click #(state/pub-event! [:graph/switch url])}}))
+                                       :on-click (fn [e]
+                                                   (if (gobj/get e "shiftKey")
+                                                     (ui-handler/open-new-window! url)
+                                                     (state/pub-event! [:graph/switch url])))}}))
                         switch-repos)
             links (->>
                    (concat repo-links

+ 2 - 1
src/main/frontend/handler/ui.cljs

@@ -301,5 +301,6 @@
     (state/pub-event! [:modal/show-cards])))
 
 (defn open-new-window!
-  []
+  [repo]
+  (when repo (storage/set :git/current-repo repo))
   (ipc/ipc "openNewWindow"))