fix: search not jump to the specific block

pull/1398/head
Tienson Qin 2021-02-25 20:26:45 +08:00
parent 8fd7e0cbbe
commit 7accf8adbc
2 changed files with 9 additions and 8 deletions

View File

@ -256,7 +256,6 @@
:clip-rule "evenodd"
:fill-rule "evenodd"}]]]
[:input#search_field.block.w-full.h-full.pr-3.py-2.rounded-md.focus:outline-none.placeholder-gray-500.focus:placeholder-gray-400.sm:text-sm.sm:bg-transparent
{:style {:padding-left "2rem"}
:placeholder (t :search)
:auto-complete (if (util/chrome?) "chrome-off" "off") ; off not working here
@ -272,7 +271,7 @@
(reset! search-timeout
(js/setTimeout
#(search-handler/search value)
100))))))}]
200))))))}]
(when-not (string/blank? search-q)
(ui/css-transition
{:class-names "fade"

View File

@ -78,17 +78,19 @@
title (get-title (:name data) path-params)]
(util/set-title! title)))
(defn jump-to-anchor!
[anchor-text]
(when anchor-text
(ui-handler/highlight-element! anchor-text)))
(defn set-route-match!
[route]
(let [route route]
(swap! state/state assoc :route-match route)
(update-page-title! route)
(util/scroll-to-top)))
(defn jump-to-anchor!
[anchor-text]
(when anchor-text
(ui-handler/highlight-element! anchor-text)))
(when-let [anchor (get-in route [:query-params :anchor])]
(jump-to-anchor! anchor)
(util/scroll-to-top))))
(defn go-to-search!
[]