Просмотр исходного кода

shift-click on Journals left sidebar item opens today's journal in right sidebar

Mike Travers 3 лет назад
Родитель
Сommit
46e3b3fc08
1 измененных файлов с 15 добавлено и 7 удалено
  1. 15 7
      src/main/frontend/handler/route.cljs

+ 15 - 7
src/main/frontend/handler/route.cljs

@@ -9,6 +9,7 @@
             [frontend.state :as state]
             [frontend.state :as state]
             [logseq.graph-parser.text :as text]
             [logseq.graph-parser.text :as text]
             [frontend.util :as util]
             [frontend.util :as util]
+            [goog.object :as gobj]
             [reitit.frontend.easy :as rfe]))
             [reitit.frontend.easy :as rfe]))
 
 
 (defn redirect!
 (defn redirect!
@@ -137,13 +138,20 @@
   (state/pub-event! [:go/search]))
   (state/pub-event! [:go/search]))
 
 
 (defn go-to-journals!
 (defn go-to-journals!
-  []
-  (state/set-journals-length! 3)
-  (let [route (if (state/custom-home-page?)
-                :all-journals
-                :home)]
-    (redirect! {:to route}))
-  (util/scroll-to-top))
+  [e]
+  (if (gobj/get e "shiftKey")           ;TODO pretty sure this test should be sidebar.cljs
+    (do
+      (state/sidebar-add-block!
+       (state/get-current-repo)
+       (:db/id (db/get-page (date/today)))
+       :page))
+    (do
+      (state/set-journals-length! 3)
+      (let [route (if (state/custom-home-page?)
+                    :all-journals
+                    :home)]
+        (redirect! {:to route}))
+      (util/scroll-to-top))))
 
 
 (defn- redirect-to-file!
 (defn- redirect-to-file!
   [page]
   [page]