mirror of https://github.com/logseq/logseq
Merge branch 'master' into feat/db
commit
1c5abc7bcc
|
@ -101,17 +101,24 @@
|
|||
(take 5 items))))
|
||||
page-exists? (when-not (string/blank? input)
|
||||
(db/entity [:block/name (string/trim input)]))
|
||||
filter-mode? (or (string/includes? input " /")
|
||||
(string/starts-with? input "/"))
|
||||
include-slash? (or (string/includes? input "/")
|
||||
(string/starts-with? input "/"))
|
||||
order* (cond
|
||||
(= search-mode :graph)
|
||||
[["Pages" :pages (visible-items :pages)]]
|
||||
|
||||
filter-mode?
|
||||
[["Filters" :filters (visible-items :filters)]
|
||||
["Pages" :pages (visible-items :pages)]
|
||||
include-slash?
|
||||
[(if page-exists?
|
||||
["Pages" :pages (visible-items :pages)]
|
||||
["Filters" :filters (visible-items :filters)])
|
||||
(if page-exists?
|
||||
["Filters" :filters (visible-items :filters)]
|
||||
["Pages" :pages (visible-items :pages)])
|
||||
(when-not page-exists?
|
||||
["Create" :create (create-items input)])]
|
||||
["Create" :create (create-items input)])
|
||||
["Current page" :current-page (visible-items :current-page)]
|
||||
["Blocks" :blocks (visible-items :blocks)]
|
||||
["Files" :files (visible-items :files)]]
|
||||
|
||||
filter-group
|
||||
[(when (= filter-group :blocks)
|
||||
|
@ -253,7 +260,7 @@
|
|||
[input]
|
||||
(or (when (string/starts-with? input "/")
|
||||
(subs input 1))
|
||||
(last (gp-util/split-last " /" input))))
|
||||
(last (gp-util/split-last "/" input))))
|
||||
|
||||
(defmethod load-results :filters [group state]
|
||||
(let [!results (::results state)
|
||||
|
@ -374,8 +381,8 @@
|
|||
(defn- get-filter-user-input
|
||||
[input]
|
||||
(cond
|
||||
(string/includes? input " /")
|
||||
(first (gp-util/split-last " /" input))
|
||||
(string/includes? input "/")
|
||||
(first (gp-util/split-last "/" input))
|
||||
(string/starts-with? input "/")
|
||||
""
|
||||
:else
|
||||
|
@ -537,11 +544,9 @@
|
|||
(reset! (::alt? state) alt?)
|
||||
(when (or as-keydown? as-keyup?)
|
||||
(.preventDefault e))
|
||||
(when-not esc? (util/stop-propagation e))
|
||||
|
||||
(cond
|
||||
(and meta? enter?
|
||||
(not (string/blank? input)))
|
||||
(and meta? enter?)
|
||||
(let [repo (state/get-current-repo)]
|
||||
(state/close-modal!)
|
||||
(state/sidebar-add-block! repo input :search))
|
||||
|
@ -552,13 +557,17 @@
|
|||
as-keyup? (if meta?
|
||||
(show-less)
|
||||
(move-highlight state -1))
|
||||
enter? (handle-action :default state e)
|
||||
enter? (do
|
||||
(handle-action :default state e)
|
||||
(util/stop-propagation e))
|
||||
esc? (let [filter @(::filter state)]
|
||||
(when (or filter (not (string/blank? input)))
|
||||
(util/stop e)
|
||||
(reset! (::filter state) nil)
|
||||
(when-not filter (handle-input-change state nil ""))))
|
||||
(= keyname "c") (copy-block-ref state)
|
||||
(and meta? (= keyname "c")) (do
|
||||
(copy-block-ref state)
|
||||
(util/stop-propagation e))
|
||||
:else nil)))
|
||||
|
||||
(defn keyup-handler
|
||||
|
@ -601,20 +610,22 @@
|
|||
:placeholder (input-placeholder false)
|
||||
:ref #(when-not @input-ref (reset! input-ref %))
|
||||
:on-change (fn [e]
|
||||
(handle-input-change state e)
|
||||
(when-let [on-change (:on-input-change opts)]
|
||||
(on-change (.-value (.-target e)))))
|
||||
(let [new-value (.-value (.-target e))]
|
||||
(handle-input-change state e)
|
||||
(when-let [on-change (:on-input-change opts)]
|
||||
(on-change new-value))))
|
||||
:on-blur (fn [_e]
|
||||
(when-let [on-blur (:on-input-blur opts)]
|
||||
(on-blur input)))
|
||||
:on-composition-end (fn [e] (handle-input-change state e))
|
||||
:on-key-down (fn [e]
|
||||
(let [value (.-value @input-ref)
|
||||
last-char (last value)]
|
||||
last-char (last value)
|
||||
backspace? (= (util/ekey e) "Backspace")]
|
||||
(when (and (some? @(::filter state))
|
||||
(or (= (util/ekey e) "/")
|
||||
(and (= (util/ekey e) "Backspace")
|
||||
(= last-char "/"))))
|
||||
(and backspace? (= last-char "/"))
|
||||
(and backspace? (= input ""))))
|
||||
(reset! (::filter state) nil))))
|
||||
:value input}]]))
|
||||
|
||||
|
@ -768,7 +779,7 @@
|
|||
:style {:background "var(--lx-gray-02)"}}
|
||||
|
||||
(when group-filter
|
||||
[:div.flex.flex-col.p-3.opacity-50.text-sm
|
||||
[:div.flex.flex-col.px-3.py-1.opacity-70.text-sm
|
||||
(search-only state (name group-filter))])
|
||||
|
||||
(let [items (filter
|
||||
|
|
|
@ -166,6 +166,17 @@
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.graph-icon .ui__icon {
|
||||
padding: 0;
|
||||
width: unset;
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
||||
.graph-icon {
|
||||
margin-left: 3px;
|
||||
margin-right: 11px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: or(--ls-left-sidebar-hover-background, --lx-gray-04, --ls-primary-background-color);
|
||||
color: or(--ls-left-sidebar-text-color-hover, --lx-gray-12);
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
[goog.object :as gobj]
|
||||
[cljs.core.async :as async :refer [go <!]]
|
||||
[frontend.handler.file-sync :as file-sync]
|
||||
[reitit.frontend.easy :as rfe]
|
||||
[logseq.shui.core :as shui]))
|
||||
[reitit.frontend.easy :as rfe]))
|
||||
|
||||
(rum/defc add-repo
|
||||
[args]
|
||||
|
@ -251,26 +250,22 @@
|
|||
(check-multiple-windows? state)
|
||||
(toggle-fn))
|
||||
:title repo-name} ;; show full path on hover
|
||||
[:span.flex.relative
|
||||
{:style {:top 1}}
|
||||
(ui/icon (if logged-in?
|
||||
(let [icon (str "letter-" (first (user-handler/email)))]
|
||||
(if (shui/tabler-icon icon) icon "user"))
|
||||
"database") {:size (if logged-in? 12 16)
|
||||
:id "database-icon"
|
||||
:class (when logged-in? "p-1 rounded")
|
||||
:style {:background-color "var(--lx-gray-06-alpha, var(--color-level-5))"
|
||||
:padding 3}})]
|
||||
[:div.graphs
|
||||
[:span#repo-switch.block.pr-2.whitespace-nowrap
|
||||
[:span [:span#repo-name.font-medium
|
||||
[:span.overflow-hidden.text-ellipsis (if (= config/local-repo short-repo-name) "Demo" short-repo-name)]
|
||||
(when remote? [:span.pl-1 (ui/icon "cloud")])]]
|
||||
[:span.dropdown-caret.ml-2 {:style {:border-top-color "#6b7280"}}]]]]))
|
||||
[:div.flex.flex-row.items-center
|
||||
[:div.flex.relative.graph-icon.rounded
|
||||
(let [icon "database"
|
||||
opts {:size 14}]
|
||||
(ui/icon icon opts))]
|
||||
|
||||
[:div.graphs
|
||||
[:span#repo-switch.block.pr-2.whitespace-nowrap
|
||||
[:span [:span#repo-name.font-medium
|
||||
[:span.overflow-hidden.text-ellipsis (if (= config/local-repo short-repo-name) "Demo" short-repo-name)]
|
||||
(when remote? [:span.pl-1 (ui/icon "cloud")])]]
|
||||
[:span.dropdown-caret.ml-2 {:style {:border-top-color "#6b7280"}}]]]]]))
|
||||
links-header (cond->
|
||||
{:z-index 1000
|
||||
:modal-class (util/hiccup->class
|
||||
"origin-top-right.absolute.left-0.mt-2.rounded-md.shadow-lg")}
|
||||
{:z-index 1000
|
||||
:modal-class (util/hiccup->class
|
||||
"origin-top-right.absolute.left-0.mt-2.rounded-md.shadow-lg")}
|
||||
(> (count repos) 1) ; show switch to if there are multiple repos
|
||||
(assoc :links-header [:div.font-medium.text-sm.opacity-70.px-4.pt-2.pb-1.flex.flex-row.justify-between.items-center
|
||||
[:div (t :left-side-bar/switch)]
|
||||
|
|
Loading…
Reference in New Issue