mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
Merge branch 'master' into feat/db
This commit is contained in:
23
deps/shui/src/logseq/shui/button/v2.cljs
vendored
23
deps/shui/src/logseq/shui/button/v2.cljs
vendored
@@ -3,11 +3,12 @@
|
||||
[clojure.string :as str]
|
||||
[rum.core :as rum]
|
||||
[logseq.shui.icon.v2 :as icon]
|
||||
[clojure.string :as string]))
|
||||
[clojure.string :as string]
|
||||
[goog.userAgent]))
|
||||
|
||||
(rum/defcs root < rum/reactive
|
||||
(rum/local nil ::hover-theme)
|
||||
[state {:keys [theme hover-theme color text depth size icon interactive shortcut tiled on-click muted disabled? class href button-props icon-props]
|
||||
[state {:keys [theme hover-theme color text depth size icon interactive shortcut tiled tiles on-click muted disabled? class href button-props icon-props]
|
||||
:or {theme :color depth 1 size :md interactive true muted false class ""}} context]
|
||||
(let [*hover-theme (::hover-theme state)
|
||||
color-string (or (some-> color name) (some-> context :state rum/react :ui/radix-color name) "custom")
|
||||
@@ -31,12 +32,14 @@
|
||||
:on-mouse-out #(reset! *hover-theme nil)}
|
||||
on-click
|
||||
(assoc :on-click on-click)))
|
||||
(if-not tiled text
|
||||
(for [[index tile] (map-indexed vector (rest (string/split text #"")))]
|
||||
[:<>
|
||||
(when (< 0 index)
|
||||
[:div.ui__button__tile-separator])
|
||||
[:div.ui__button__tile tile]]))
|
||||
(if (and tiled (or text tiles))
|
||||
(for [[index tile] (map-indexed vector
|
||||
(or tiles (and text (rest (string/split text #"")))))]
|
||||
[:<>
|
||||
(when (< 0 index)
|
||||
[:div.ui__button__tile-separator])
|
||||
[:div.ui__button__tile tile]])
|
||||
text)
|
||||
|
||||
(when icon
|
||||
(icon/root icon icon-props))
|
||||
@@ -44,9 +47,9 @@
|
||||
(for [key shortcut]
|
||||
[:div.ui__button-shortcut-key
|
||||
(case key
|
||||
"cmd" [:div "⌘"]
|
||||
"cmd" [:div (if goog.userAgent/MAC "⌘" "Ctrl")]
|
||||
"shift" [:div "⇧"]
|
||||
"return" [:div "↵"]
|
||||
"return" [:div "⏎"]
|
||||
"esc" [:div.tracking-tightest {:style {:transform "scaleX(0.8) scaleY(1.2) "
|
||||
:font-size "0.5rem"
|
||||
:font-weight "500"}} "ESC"]
|
||||
|
||||
17
deps/shui/src/logseq/shui/list_item/v1.cljs
vendored
17
deps/shui/src/logseq/shui/list_item/v1.cljs
vendored
@@ -77,12 +77,12 @@
|
||||
|
||||
(rum/defc root [{:keys [icon icon-theme query text info shortcut value-label value
|
||||
title highlighted on-highlight on-highlight-dep header on-click
|
||||
hoverable compact rounded on-mouse-enter component-opts
|
||||
display-shortcut-on-highlight?] :as _props
|
||||
hoverable compact rounded on-mouse-enter component-opts] :as _props
|
||||
:or {hoverable true rounded true}}
|
||||
{:keys [app-config] :as context}]
|
||||
(let [ref (rum/create-ref)
|
||||
highlight-query (partial highlight-query* app-config query)]
|
||||
highlight-query (partial highlight-query* app-config query)
|
||||
[hover? set-hover?] (rum/use-state false)]
|
||||
(rum/use-effect!
|
||||
(fn []
|
||||
(when (and highlighted on-highlight)
|
||||
@@ -99,6 +99,8 @@
|
||||
(not highlighted) (str " "))
|
||||
:ref ref
|
||||
:on-click (when on-click on-click)
|
||||
:on-mouse-over #(set-hover? true)
|
||||
:on-mouse-out #(set-hover? false)
|
||||
:on-mouse-enter (when on-mouse-enter on-mouse-enter)}
|
||||
component-opts)
|
||||
;; header
|
||||
@@ -133,10 +135,7 @@
|
||||
[:span.text-gray-11 (str (to-string value-label))])
|
||||
(when value
|
||||
[:span.text-gray-11 (to-string value)])])
|
||||
(when (and shortcut
|
||||
(or (and display-shortcut-on-highlight? highlighted)
|
||||
(not display-shortcut-on-highlight?)))
|
||||
[:div {:class (str "flex gap-1"
|
||||
(when display-shortcut-on-highlight? " fade-in"))
|
||||
:style {:opacity (if highlighted 1 0.5)}}
|
||||
(when shortcut
|
||||
[:div {:class "flex gap-1"
|
||||
:style {:opacity (if (or highlighted hover?) 1 0.5)}}
|
||||
(shortcut/root shortcut context)])]]))
|
||||
|
||||
146
deps/shui/src/logseq/shui/shortcut/v1.cljs
vendored
146
deps/shui/src/logseq/shui/shortcut/v1.cljs
vendored
@@ -6,35 +6,42 @@
|
||||
|
||||
(def mac? goog.userAgent/MAC)
|
||||
(defn print-shortcut-key [key]
|
||||
(case key
|
||||
("cmd" "command" "mod" "⌘" "meta") "⌘"
|
||||
("return" "enter" "⏎") "⏎"
|
||||
("shift" "⇧") "⇧"
|
||||
("alt" "option" "opt" "⌥") "⌥"
|
||||
("ctrl" "control" "⌃") "⌃"
|
||||
("space" " ") " "
|
||||
("up" "↑") "↑"
|
||||
("down" "↓") "↓"
|
||||
("left" "←") "←"
|
||||
("right" "→") "→"
|
||||
("tab") "⇥"
|
||||
("open-square-bracket") "["
|
||||
("close-square-bracket") "]"
|
||||
("dash") "-"
|
||||
("semicolon") ";"
|
||||
("equals") "="
|
||||
("single-quote") "'"
|
||||
("backslash") "\\"
|
||||
("comma") ","
|
||||
("period") "."
|
||||
("slash") "/"
|
||||
("grave-accent") "`"
|
||||
("page-up") ""
|
||||
("page-down") ""
|
||||
(nil) ""
|
||||
(name key)))
|
||||
(let [result (if (coll? key)
|
||||
(string/join "+" key)
|
||||
(case (if (string? key)
|
||||
(string/lower-case key)
|
||||
key)
|
||||
("cmd" "command" "mod" "⌘") (if mac? "⌘" "Ctrl")
|
||||
("meta") (if mac? "⌘" "⊞")
|
||||
("return" "enter" "⏎") "⏎"
|
||||
("shift" "⇧") "⇧"
|
||||
("alt" "option" "opt" "⌥") (if mac? "Opt" "Alt")
|
||||
("ctrl" "control" "⌃") "Ctrl"
|
||||
("space" " ") "Space"
|
||||
("up" "↑") "↑"
|
||||
("down" "↓") "↓"
|
||||
("left" "←") "←"
|
||||
("right" "→") "→"
|
||||
("tab") "Tab"
|
||||
("open-square-bracket") "["
|
||||
("close-square-bracket") "]"
|
||||
("dash") "-"
|
||||
("semicolon") ";"
|
||||
("equals") "="
|
||||
("single-quote") "'"
|
||||
("backslash") "\\"
|
||||
("comma") ","
|
||||
("period") "."
|
||||
("slash") "/"
|
||||
("grave-accent") "`"
|
||||
("page-up") ""
|
||||
("page-down") ""
|
||||
(nil) ""
|
||||
(name key)))]
|
||||
(if (= (count result) 1)
|
||||
result
|
||||
(string/capitalize result))))
|
||||
|
||||
;; TODO: shortcut component shouldn't worry about this
|
||||
(defn to-string [input]
|
||||
(cond
|
||||
(string? input) input
|
||||
@@ -45,57 +52,38 @@
|
||||
(nil? input) ""
|
||||
:else (pr-str input)))
|
||||
|
||||
(defn- parse-shortcuts
|
||||
[s]
|
||||
(->> (string/split s #" \| ")
|
||||
(map (fn [x]
|
||||
(->> (string/split x #" ")
|
||||
(map #(if (string/includes? % "+")
|
||||
(string/split % #"\+")
|
||||
%)))))))
|
||||
|
||||
(rum/defc part
|
||||
[context theme ks size]
|
||||
(button/root {:theme theme
|
||||
:interactive false
|
||||
:tiled true
|
||||
:tiles (map print-shortcut-key ks)
|
||||
:size size
|
||||
:mused true}
|
||||
context))
|
||||
|
||||
(rum/defc root
|
||||
[shortcut context & {:keys [tiled size theme]
|
||||
:or {tiled true
|
||||
size :sm
|
||||
[shortcut context & {:keys [size theme]
|
||||
:or {size :sm
|
||||
theme :gray}}]
|
||||
(when (seq shortcut)
|
||||
(if (coll? shortcut)
|
||||
(let [texts (map print-shortcut-key shortcut)
|
||||
tiled? (every? #(= (count %) 1) texts)]
|
||||
(if tiled?
|
||||
[:div.flex.flex-row
|
||||
(for [text texts]
|
||||
(button/root {:theme theme
|
||||
:interactive false
|
||||
:text (to-string text)
|
||||
:tiled tiled?
|
||||
:size size
|
||||
:mused true}
|
||||
context))]
|
||||
(let [text' (string/join " " texts)]
|
||||
(button/root {:theme theme
|
||||
:interactive false
|
||||
:text text'
|
||||
:tiled false
|
||||
:size size
|
||||
:mused true}
|
||||
context))))
|
||||
[:<>
|
||||
(for [[index option] (map-indexed vector (string/split shortcut #" \| "))]
|
||||
[:<>
|
||||
(when (< 0 index)
|
||||
[:div.text-gray-11.text-sm "|"])
|
||||
(let [[system-default option] (if (.startsWith option "system default: ")
|
||||
[true (subs option 16)]
|
||||
[false option])]
|
||||
[:<>
|
||||
(when system-default
|
||||
[:div.mr-1.text-xs "System default: "])
|
||||
(for [sequence (string/split option #" ")
|
||||
:let [text (->> (string/split sequence #"\+")
|
||||
(map print-shortcut-key)
|
||||
(apply str))]]
|
||||
(let [tiled? (if (contains?
|
||||
#{"backspace" "delete" "home" "end" "insert"}
|
||||
(string/lower-case text))
|
||||
false
|
||||
tiled)]
|
||||
(button/root {:theme theme
|
||||
:interactive false
|
||||
:text (to-string text)
|
||||
:tiled tiled?
|
||||
:size size
|
||||
:mused true}
|
||||
context)))])])])))
|
||||
(let [shortcuts (if (coll? shortcut)
|
||||
[shortcut]
|
||||
(parse-shortcuts shortcut))]
|
||||
(for [[index binding] (map-indexed vector shortcuts)]
|
||||
[:<>
|
||||
(when (< 0 index)
|
||||
[:div.text-gray-11.text-sm "|"])
|
||||
(if (coll? (first binding)) ; + included
|
||||
(for [ks binding]
|
||||
(part context theme ks size))
|
||||
(part context theme binding size))]))))
|
||||
|
||||
@@ -14,6 +14,12 @@ import { dispatch_kb_events } from './util/keyboard-events'
|
||||
import * as kb_events from './util/keyboard-events'
|
||||
|
||||
test('hashtag and quare brackets in same line #4178', async ({ page }) => {
|
||||
try {
|
||||
await page.waitForSelector('.notification-clear', { timeout: 10 })
|
||||
page.click('.notification-clear')
|
||||
} catch (error) {
|
||||
}
|
||||
|
||||
await createRandomPage(page)
|
||||
|
||||
await page.type('textarea >> nth=0', '#foo bar')
|
||||
|
||||
@@ -40,7 +40,7 @@ test('Search page and blocks (diacritics)', async ({ page, block }) => {
|
||||
|
||||
// check if diacritics are indexed
|
||||
const results = await searchPage(page, 'Einführung in die Allgemeine Sprachwissenschaft' + rand)
|
||||
await expect(results.length).toEqual(5) // 1 page + 2 block + 2 page content
|
||||
await expect(results.length).toEqual(6) // 1 page + 2 block + 2 page content + 1 current page
|
||||
await closeSearchBox(page)
|
||||
})
|
||||
|
||||
|
||||
@@ -23,19 +23,22 @@
|
||||
}
|
||||
|
||||
.ui__button-tiled .ui__button__tile {
|
||||
@apply flex items-center justify-center text-center;
|
||||
@apply flex items-center justify-center text-center px-1;
|
||||
}
|
||||
|
||||
.ui__button-tiled.ui__button-size-md .ui__button__tile {
|
||||
@apply h-6 w-6;
|
||||
@apply h-6;
|
||||
min-width: 1.5rem;
|
||||
}
|
||||
|
||||
.ui__button-tiled.ui__button-size-sm .ui__button__tile {
|
||||
@apply h-4 w-4;
|
||||
@apply h-4;
|
||||
min-width: 1rem;
|
||||
}
|
||||
|
||||
.ui__button__tile-separator {
|
||||
@apply w-px h-full bg-gray-08-alpha;
|
||||
min-height: 14px;
|
||||
}
|
||||
|
||||
.ui__button-theme-text {
|
||||
|
||||
@@ -85,5 +85,6 @@
|
||||
(str/replace "hsl(" "")
|
||||
(str/replace ")" "")
|
||||
(str/split ","))]
|
||||
(let [hsl-color (map js/parseFloat hsl-color)]
|
||||
(when-let [hsl-color (and (not (str/blank? (first hsl-color)))
|
||||
(map js/parseFloat hsl-color))]
|
||||
(apply util/hsl2hex hsl-color))))
|
||||
|
||||
@@ -923,6 +923,10 @@ html.is-mobile {
|
||||
#journals .journal-item:first-child {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
main.theme-inner {
|
||||
@apply overflow-x-hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@layer base {
|
||||
|
||||
@@ -3604,10 +3604,8 @@
|
||||
(:db/id parent)))))
|
||||
{:debug-id page})])))))]
|
||||
|
||||
(and (:ref? config)
|
||||
(:group-by-page? config)
|
||||
(vector? (first blocks)))
|
||||
[:div.flex.flex-col
|
||||
(and (:ref? config) (:group-by-page? config) (vector? (first blocks)))
|
||||
[:div.flex.flex-col.references-blocks-wrap
|
||||
(let [blocks (sort-by (comp :block/journal-day first) > blocks)]
|
||||
(for [[page page-blocks] blocks]
|
||||
(ui/lazy-visible
|
||||
@@ -3617,7 +3615,7 @@
|
||||
page (db/entity (:db/id page))
|
||||
;; FIXME: parents need to be sorted
|
||||
parent-blocks (group-by :block/parent page-blocks)]
|
||||
[:div.my-2 {:key (str "page-" (:db/id page))}
|
||||
[:div.my-2.references-blocks-item {:key (str "page-" (:db/id page))}
|
||||
(ui/foldable
|
||||
[:div
|
||||
(page-cp config page)
|
||||
|
||||
@@ -479,6 +479,7 @@
|
||||
|
||||
.color-level {
|
||||
background-color: or(--ls-right-sidebar-content-background, --lx-gray-02, --color-level-1);
|
||||
|
||||
.dark & {
|
||||
background-color: or(--ls-right-sidebar-content-background, --lx-gray-01, --color-level-1);
|
||||
}
|
||||
@@ -740,3 +741,19 @@ html.is-mac {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.references-blocks {
|
||||
&-wrap {
|
||||
.foldable-title {
|
||||
@apply ml-3;
|
||||
|
||||
.block-control {
|
||||
@apply relative right-[-5px] top-[1px];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-item {
|
||||
@apply bg-gray-03 rounded p-4;
|
||||
}
|
||||
}
|
||||
@@ -206,21 +206,22 @@
|
||||
repo (state/get-current-repo)]
|
||||
(swap! !results assoc-in [group :status] :loading)
|
||||
(p/let [pages (search/page-search @!input)
|
||||
items (map
|
||||
(fn [page]
|
||||
(let [entity (db/entity [:block/name (util/page-name-sanity-lc page)])
|
||||
whiteboard? (= (:block/type entity) "whiteboard")
|
||||
source-page (model/get-alias-source-page repo page)]
|
||||
(hash-map :icon (if whiteboard? "whiteboard" "page")
|
||||
:icon-theme :gray
|
||||
:text (if source-page
|
||||
[:div.flex.flex-row.items-center.gap-2
|
||||
page
|
||||
[:div.opacity-50.font-normal "alias of"]
|
||||
(:block/original-name source-page)]
|
||||
page)
|
||||
:source-page page)))
|
||||
pages)]
|
||||
items (->> pages
|
||||
(remove nil?)
|
||||
(map
|
||||
(fn [page]
|
||||
(let [entity (db/entity [:block/name (util/page-name-sanity-lc page)])
|
||||
whiteboard? (= (:block/type entity) "whiteboard")
|
||||
source-page (model/get-alias-source-page repo page)]
|
||||
(hash-map :icon (if whiteboard? "whiteboard" "page")
|
||||
:icon-theme :gray
|
||||
:text (if source-page
|
||||
[:div.flex.flex-row.items-center.gap-2
|
||||
page
|
||||
[:div.opacity-50.font-normal "alias of"]
|
||||
(:block/original-name source-page)]
|
||||
page)
|
||||
:source-page page)))))]
|
||||
(swap! !results update group merge {:status :success :items items}))))
|
||||
|
||||
;; The blocks search action uses an existing handler
|
||||
@@ -263,6 +264,27 @@
|
||||
files)]
|
||||
(swap! !results update group merge {:status :success :items items}))))
|
||||
|
||||
;; FIXME: recent search
|
||||
;; (defmethod load-results :recents [group state]
|
||||
;; (let [!input (::input state)
|
||||
;; !results (::results state)
|
||||
;; recent-searches (mapv (fn [q] {:type :search :data q}) (db/get-key-value :recent/search))
|
||||
;; recent-pages (->> (filter string? (db/get-key-value :recent/pages))
|
||||
;; (keep (fn [page]
|
||||
;; (when-let [page-entity (db/entity [:block/name (util/page-name-sanity-lc page)])]
|
||||
;; {:type :page :data (:block/original-name page-entity)})))
|
||||
;; vec)]
|
||||
;; (swap! !results assoc-in [group :status] :loading)
|
||||
;; (let [items (->> (concat recent-searches recent-pages)
|
||||
;; (filter #(string/includes? (lower-case-str (:data %)) (lower-case-str @!input)))
|
||||
;; (map #(hash-map :icon (if (= :page (:type %)) "page" "history")
|
||||
;; :icon-theme :gray
|
||||
;; :text (:data %)
|
||||
;; :source-recent %
|
||||
;; :source-page (when (= :page (:type %)) (:data %))
|
||||
;; :source-search (when (= :search (:type %)) (:data %)))))]
|
||||
;; (swap! !results update group merge {:status :success :items items}))))
|
||||
|
||||
(defn- get-filter-q
|
||||
[input]
|
||||
(or (when (string/starts-with? input "/")
|
||||
@@ -291,14 +313,10 @@
|
||||
(load-results :filters state)
|
||||
(load-results :files state))))
|
||||
|
||||
(defn close-unless-alt! [state]
|
||||
(when-not (some-> state ::alt? deref)
|
||||
(state/close-modal!)))
|
||||
|
||||
(defn- copy-block-ref [state]
|
||||
(when-let [block-uuid (some-> state state->highlighted-item :source-block :block/uuid uuid)]
|
||||
(editor-handler/copy-block-ref! block-uuid block-ref/->block-ref)
|
||||
(close-unless-alt! state)))
|
||||
(state/close-modal!)))
|
||||
|
||||
(defmulti handle-action (fn [action _state _event] action))
|
||||
|
||||
@@ -310,7 +328,7 @@
|
||||
(if (= (:block/type page) "whiteboard")
|
||||
(route-handler/redirect-to-whiteboard! original-name)
|
||||
(route-handler/redirect-to-page! original-name)))
|
||||
(close-unless-alt! state)))
|
||||
(state/close-modal!)))
|
||||
|
||||
(defmethod handle-action :open-block [_ state _event]
|
||||
(let [block-id (some-> state state->highlighted-item :source-block :block/uuid uuid)
|
||||
@@ -320,7 +338,7 @@
|
||||
(if (= (:block/type page) "whiteboard")
|
||||
(route-handler/redirect-to-whiteboard! page-name {:block-id block-id})
|
||||
(route-handler/redirect-to-page! page-name {:anchor (str "ls-block-" block-id)})))
|
||||
(close-unless-alt! state))))
|
||||
(state/close-modal!))))
|
||||
|
||||
(defmethod handle-action :open-page-right [_ state _event]
|
||||
(when-let [page-name (some-> state state->highlighted-item :source-page)]
|
||||
@@ -328,12 +346,12 @@
|
||||
page (db/entity [:block/name (util/page-name-sanity-lc redirect-page-name)])]
|
||||
(when page
|
||||
(editor-handler/open-block-in-sidebar! (:block/uuid page))))
|
||||
(close-unless-alt! state)))
|
||||
(state/close-modal!)))
|
||||
|
||||
(defmethod handle-action :open-block-right [_ state _event]
|
||||
(when-let [block-uuid (some-> state state->highlighted-item :source-block :block/uuid uuid)]
|
||||
(editor-handler/open-block-in-sidebar! block-uuid)
|
||||
(close-unless-alt! state)))
|
||||
(state/close-modal!)))
|
||||
|
||||
(defmethod handle-action :open [_ state event]
|
||||
(when-let [item (some-> state state->highlighted-item)]
|
||||
@@ -366,7 +384,7 @@
|
||||
(when-let [action (:action command)]
|
||||
(action)
|
||||
(when-not (contains? #{:graph/open :graph/remove :ui/toggle-settings :go/flashcards} (:id command))
|
||||
(close-unless-alt! state)))))
|
||||
(state/close-modal!)))))
|
||||
|
||||
(defmethod handle-action :create [_ state _event]
|
||||
(let [item (state->highlighted-item state)
|
||||
@@ -374,20 +392,17 @@
|
||||
create-class? (string/starts-with? @!input "#")
|
||||
create-whiteboard? (= :whiteboard (:source-create item))
|
||||
create-page? (= :page (:source-create item))
|
||||
alt? (some-> state ::alt deref)
|
||||
class (when create-class? (get-class-from-input @!input))]
|
||||
(cond
|
||||
create-class? (page-handler/create! class
|
||||
{:redirect? false
|
||||
:create-first-block? false
|
||||
:class? true})
|
||||
(and create-whiteboard? alt?) (whiteboard-handler/create-new-whiteboard-page! @!input)
|
||||
(and create-whiteboard? (not alt?)) (whiteboard-handler/create-new-whiteboard-and-redirect! @!input)
|
||||
(and create-page? alt?) (page-handler/create! @!input {:redirect? false})
|
||||
(and create-page? (not alt?)) (page-handler/create! @!input {:redirect? true}))
|
||||
create-whiteboard? (whiteboard-handler/create-new-whiteboard-and-redirect! @!input)
|
||||
create-page? (page-handler/create! @!input {:redirect? true}))
|
||||
(if create-class?
|
||||
(state/pub-event! [:class/configure (db/entity [:block/name (util/page-name-sanity-lc class)])])
|
||||
(close-unless-alt! state))))
|
||||
(state/close-modal!))))
|
||||
|
||||
(defn- get-filter-user-input
|
||||
[input]
|
||||
@@ -490,7 +505,6 @@
|
||||
:rounded false
|
||||
:hoverable @*mouse-active?
|
||||
:highlighted highlighted?
|
||||
:display-shortcut-on-highlight? true
|
||||
;; for some reason, the highlight effect does not always trigger on a
|
||||
;; boolean value change so manually pass in the dep
|
||||
:on-highlight-dep highlighted-item
|
||||
@@ -545,8 +559,7 @@
|
||||
(defn- keydown-handler
|
||||
[state e]
|
||||
(let [shift? (.-shiftKey e)
|
||||
meta? (.-metaKey e)
|
||||
alt? (.-altKey e)
|
||||
meta? (util/meta-key? e)
|
||||
ctrl? (.-ctrlKey e)
|
||||
keyname (.-key e)
|
||||
enter? (= keyname "Enter")
|
||||
@@ -560,7 +573,6 @@
|
||||
as-keyup? (or (= keyname "ArrowUp") (and ctrl? (= keyname "p")))]
|
||||
(reset! (::shift? state) shift?)
|
||||
(reset! (::meta? state) meta?)
|
||||
(reset! (::alt? state) alt?)
|
||||
(when (or as-keydown? as-keyup?)
|
||||
(.preventDefault e))
|
||||
|
||||
@@ -593,10 +605,8 @@
|
||||
(defn- keyup-handler
|
||||
[state e]
|
||||
(let [shift? (.-shiftKey e)
|
||||
meta? (.-metaKey e)
|
||||
alt? (.-altKey e)]
|
||||
meta? (util/meta-key? e)]
|
||||
(reset! (::shift? state) shift?)
|
||||
(reset! (::alt? state) alt?)
|
||||
(reset! (::meta? state) meta?)))
|
||||
|
||||
(defn- input-placeholder
|
||||
@@ -657,8 +667,8 @@
|
||||
(shui/shortcut "/" context)
|
||||
[:div "to filter search results"]]
|
||||
[:div.flex.flex-row.gap-1.items-center.opacity-50.hover:opacity-100
|
||||
(shui/shortcut "mod enter" context)
|
||||
[:div "to open search in the sidebar"]]]))
|
||||
(shui/shortcut ["mod" "enter"] context)
|
||||
[:div "to open search in the sidebar"]]]) )
|
||||
|
||||
(rum/defcs tip <
|
||||
{:init (fn [state]
|
||||
@@ -772,7 +782,6 @@
|
||||
(keyup-handler state e))))))
|
||||
(rum/local false ::shift?)
|
||||
(rum/local false ::meta?)
|
||||
(rum/local false ::alt?)
|
||||
(rum/local nil ::highlighted-group)
|
||||
(rum/local nil ::highlighted-item)
|
||||
(rum/local default-results ::results)
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
.dark .left-sidebar-inner {
|
||||
background-color: or(--ls-left-sidebar-background-color, --lx-gray-01, --ls-primary-background);
|
||||
background-color: or(--ls-left-sidebar-background-color, --lx-gray-01, --ls-primary-background-color);
|
||||
}
|
||||
|
||||
.left-sidebar-inner {
|
||||
@@ -683,7 +683,7 @@
|
||||
}
|
||||
|
||||
.references {
|
||||
margin-left: 12px;
|
||||
@apply mx-[28px];
|
||||
}
|
||||
|
||||
.sidebar-drop-indicator {
|
||||
@@ -757,6 +757,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.page-hierarchy {
|
||||
@apply pl-[28px];
|
||||
}
|
||||
}
|
||||
|
||||
.cp__sidebar-main-content[data-is-full-width='true'] {
|
||||
|
||||
@@ -459,7 +459,7 @@
|
||||
|
||||
(cond
|
||||
(or unset? user-binding (false? user-binding))
|
||||
[:code.dark:bg-green-800.bg-green-300
|
||||
[:code
|
||||
(if unset?
|
||||
(t :keymap/unset)
|
||||
(str (t :keymap/custom) ": "
|
||||
|
||||
@@ -3,13 +3,18 @@
|
||||
(:require [frontend.handler.db-based.recent :as db-based]
|
||||
[frontend.handler.file-based.recent :as file-recent-handler]
|
||||
[frontend.config :as config]
|
||||
[frontend.state :as state]))
|
||||
[frontend.state :as state]
|
||||
[frontend.db.model :as model]))
|
||||
|
||||
(defn add-page-to-recent!
|
||||
[repo page click-from-recent?]
|
||||
(if (config/db-based-graph? repo)
|
||||
(db-based/add-page-to-recent! page click-from-recent?)
|
||||
(file-recent-handler/add-page-to-recent! repo page click-from-recent?)))
|
||||
[repo page-name-or-block-uuid click-from-recent?]
|
||||
(let [page-name (if (uuid? page-name-or-block-uuid)
|
||||
(when-let [block (model/get-block-by-uuid page-name-or-block-uuid)]
|
||||
(get-in block [:block/page :block/original-name]))
|
||||
page-name-or-block-uuid)]
|
||||
(if (config/db-based-graph? repo)
|
||||
(db-based/add-page-to-recent! page-name click-from-recent?)
|
||||
(file-recent-handler/add-page-to-recent! repo page-name click-from-recent?))))
|
||||
|
||||
(defn get-recent-pages
|
||||
[]
|
||||
|
||||
@@ -134,14 +134,33 @@
|
||||
(and (<= 400 (:status resp))
|
||||
(> 500 (:status resp)))
|
||||
;; invalid refresh-token
|
||||
(clear-tokens)
|
||||
(do
|
||||
(prn :debug :refresh-token-failed
|
||||
:status (:status resp)
|
||||
:user-id (user-uuid)
|
||||
:refresh-token refresh-token
|
||||
:resp resp)
|
||||
(state/pub-event! [:instrument {:type :refresh-token-failed
|
||||
:payload {:status (:status resp)
|
||||
:user-id (user-uuid)
|
||||
:refresh-token refresh-token
|
||||
:resp resp}}])
|
||||
(when (and (= 400 (:status resp))
|
||||
(= (:error (:body resp)) "invalid_grant"))
|
||||
(clear-tokens)))
|
||||
|
||||
;; e.g. api return 500, server internal error
|
||||
;; we shouldn't clear tokens if they aren't expired yet
|
||||
;; the `refresh-tokens-loop` will retry soon
|
||||
(and (not (http/unexceptional-status? (:status resp)))
|
||||
(not (-> (state/get-auth-id-token) parse-jwt expired?)))
|
||||
nil ; do nothing
|
||||
(do
|
||||
(prn :debug :refresh-token-failed
|
||||
:status (:status resp)
|
||||
:body (:body resp)
|
||||
:error-code (:error-code resp)
|
||||
:error-text (:error-text resp))
|
||||
nil) ; do nothing
|
||||
|
||||
(not (http/unexceptional-status? (:status resp)))
|
||||
(notification/show! "exceptional status when refresh-token" :warning true)
|
||||
@@ -217,14 +236,15 @@
|
||||
|
||||
(defn <ensure-id&access-token
|
||||
[]
|
||||
(go
|
||||
(when (or (nil? (state/get-auth-id-token))
|
||||
(-> (state/get-auth-id-token) parse-jwt almost-expired-or-expired?))
|
||||
(debug/pprint (str "refresh tokens... " (tc/to-string (t/now))))
|
||||
(<! (<refresh-id-token&access-token))
|
||||
(when (or (nil? (state/get-auth-id-token))
|
||||
(-> (state/get-auth-id-token) parse-jwt expired?))
|
||||
(ex-info "empty or expired token and refresh failed" {:anom :expired-token})))))
|
||||
(let [id-token (state/get-auth-id-token)]
|
||||
(go
|
||||
(when (or (nil? id-token)
|
||||
(-> id-token parse-jwt almost-expired-or-expired?))
|
||||
(debug/pprint (str "refresh tokens... " (tc/to-string (t/now))))
|
||||
(<! (<refresh-id-token&access-token))
|
||||
(when (or (nil? (state/get-auth-id-token))
|
||||
(-> (state/get-auth-id-token) parse-jwt expired?))
|
||||
(ex-info "empty or expired token and refresh failed" {:anom :expired-token}))))))
|
||||
|
||||
(defn <user-uuid
|
||||
[]
|
||||
|
||||
@@ -140,10 +140,10 @@
|
||||
(let [tmp (cond
|
||||
(false? binding)
|
||||
(cond
|
||||
(and util/mac? (= k :editor/kill-line-after)) "system default: ctrl k"
|
||||
(and util/mac? (= k :editor/beginning-of-block)) "system default: ctrl a"
|
||||
(and util/mac? (= k :editor/end-of-block)) "system default: ctrl e"
|
||||
(and util/mac? (= k :editor/backward-kill-word)) "system default: opt delete"
|
||||
(and util/mac? (= k :editor/kill-line-after)) "ctrl k"
|
||||
(and util/mac? (= k :editor/beginning-of-block)) "ctrl a"
|
||||
(and util/mac? (= k :editor/end-of-block)) "ctrl e"
|
||||
(and util/mac? (= k :editor/backward-kill-word)) "opt delete"
|
||||
:else (t :keymap/disabled))
|
||||
|
||||
(string? binding)
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
[frontend.config :as config]
|
||||
[frontend.util :as util]
|
||||
["fuse.js" :as fuse]
|
||||
[datascript.impl.entity :as e]))
|
||||
[datascript.impl.entity :as e]
|
||||
[frontend.handler.file-based.property.util :as property-util]))
|
||||
|
||||
;; Notice: When breaking changes happen, bump version in src/electron/electron/search.cljs
|
||||
|
||||
@@ -58,17 +59,22 @@
|
||||
|
||||
(defn block->index
|
||||
"Convert a block to the index for searching"
|
||||
[{:block/keys [uuid page content properties] :as block}]
|
||||
[{:block/keys [uuid page content properties format]
|
||||
:or {format :markdown}
|
||||
:as block}]
|
||||
(let [repo (state/get-current-repo)]
|
||||
(when-not (> (count content) (max-len))
|
||||
(when-not (and (string/blank? content)
|
||||
(empty? properties))
|
||||
(let [m {:id (:db/id block)
|
||||
(let [db-based? (config/db-based-graph? repo)
|
||||
content (if db-based? content
|
||||
(property-util/remove-built-in-properties format content))
|
||||
m {:id (:db/id block)
|
||||
:uuid (str uuid)
|
||||
:page (if (or (map? page) (e/entity? page)) (:db/id page) page)
|
||||
:content (sanitize content)}
|
||||
m' (cond-> m
|
||||
(and (config/db-based-graph? repo) (seq properties))
|
||||
(and db-based? (seq properties))
|
||||
(update :content
|
||||
(fn [content]
|
||||
(str content "\n"
|
||||
|
||||
@@ -819,7 +819,7 @@
|
||||
(when-let [f (:init-collapsed (last (:rum/args state)))]
|
||||
(f (::collapsed? state)))
|
||||
state)}
|
||||
[state header content {:keys [title-trigger? on-mouse-down
|
||||
[state header content {:keys [title-trigger? on-mouse-down class
|
||||
_default-collapsed? _init-collapsed]}]
|
||||
(let [collapsed? (get state ::collapsed?)
|
||||
on-mouse-down (fn [e]
|
||||
@@ -828,6 +828,7 @@
|
||||
(when on-mouse-down
|
||||
(on-mouse-down @collapsed?)))]
|
||||
[:div.flex.flex-col
|
||||
{:class class}
|
||||
(foldable-title {:on-mouse-down on-mouse-down
|
||||
:header header
|
||||
:title-trigger? title-trigger?
|
||||
|
||||
@@ -17,6 +17,14 @@
|
||||
:on-boarding/tour-whiteboard-home-description "すぐに見つけられるように、また簡単に新規作成したり削除したりできるように、ホワイトボードは専用の欄が用意されています。"
|
||||
:on-boarding/tour-whiteboard-new "{1} ホワイトボードを新規作成する"
|
||||
:on-boarding/tour-whiteboard-new-description "ホワイトボードの新規作成には、複数の方法があります。ダッシュボードのちょうどこの位置に配置されたボタンもその一つです。"
|
||||
:handbook/title "ヘルプ"
|
||||
:handbook/topics "話題"
|
||||
:handbook/popular-topics "人気のある話題"
|
||||
:handbook/help-categories "ヘルプのカテゴリ"
|
||||
:handbook/search "検索"
|
||||
:handbook/home "ホーム"
|
||||
:handbook/settings "設定"
|
||||
:handbook/close "閉じる"
|
||||
:on-boarding/tour-whiteboard-btn-next "進む"
|
||||
:on-boarding/tour-whiteboard-btn-back "戻る"
|
||||
:on-boarding/tour-whiteboard-btn-finish "完了"
|
||||
@@ -102,6 +110,7 @@
|
||||
:help/shortcuts "キーボードショートカット"
|
||||
:help/shortcuts-triggers "トリガー"
|
||||
:help/shortcut "ショートカット"
|
||||
:help/search "ページ、ブロック、コマンドを検索"
|
||||
:help/slash-autocomplete "スラッシュで自動補完"
|
||||
:help/reference-autocomplete "ページ参照の自動補完"
|
||||
:help/block-reference "ブロック参照"
|
||||
@@ -162,7 +171,7 @@
|
||||
:page/slide-view-tip-go-fullscreen (fn [] [[:span.opacity-70 "お役立ち情報:"] [:code "f"] [:span.opacity-70 "を押すことでフルスクリーンにできます"]])
|
||||
:page/delete-confirmation "このページとページのファイルを削除してもよいですか?"
|
||||
:page/open-in-finder "ディレクトリで開く"
|
||||
:page/open-with-default-app "デフォルトのアプリで開く"
|
||||
:page/open-with-default-app "既定のアプリで開く"
|
||||
:page/make-public "パブリッシュのため公開する"
|
||||
:page/version-history "ページ履歴の確認"
|
||||
:page/open-backup-directory "ページのバックアップディレクトリを開く"
|
||||
@@ -254,7 +263,7 @@
|
||||
:context-menu/input-template-name "このテンプレートの名前は?"
|
||||
:context-menu/template-include-parent-block "テンプレートに親ブロックを含めますか?"
|
||||
:context-menu/template-exists-warning "テンプレートが既に存在します。"
|
||||
:settings-page/git-tip "もしLogseq Syncが有効なら、ページの編集履歴は直接見ることができます。この節は技術に精通している人のためのものになります。"
|
||||
:settings-page/git-tip "Logseq Syncが有効な場合、ページの編集履歴を直接見ることができます。この節は技術に精通している人のためのものになります。"
|
||||
:settings-page/git-desc-1 "ページの編集履歴を見たい場合は、右上の端にある横向き三点ボタンをクリックし、「ページ履歴の確認」を選択してください。"
|
||||
:settings-page/git-desc-2 "玄人なユーザーには、バージョンコントロールとして"
|
||||
:settings-page/git-desc-3 " の利用も用意しています。Gitの利用はご自身の責任で行ってください。一般的なGitの問題について、Logseqチームはサポートしません。"
|
||||
@@ -279,7 +288,7 @@
|
||||
:settings-page/disable-sentry "使用状況データと診断内容をLogseqへ送信します。"
|
||||
:settings-page/disable-sentry-desc "Logseqはあなたのローカルなグラフを決して取得しませんし、あなたのデータを売ることも決してありません。 "
|
||||
:settings-page/preferred-outdenting "論理的なアウトデント"
|
||||
:settings-page/preferred-outdenting-tip "左側はデフォルトの設定のアウトデントを示しています。右側は論理的なアウトデントを有効にした場合のアウトデントを示しています。"
|
||||
:settings-page/preferred-outdenting-tip "左側は既定のままの場合のアウトデントを示しています。右側は論理的なアウトデントを有効にした場合のアウトデントを示しています。"
|
||||
:settings-page/preferred-outdenting-tip-more "→ もっと学ぶ"
|
||||
:settings-page/show-full-blocks "ブロック参照の全ての行を表示する"
|
||||
:settings-page/auto-expand-block-refs "ズームインしたとき、ブロック参照を自動で展開する"
|
||||
@@ -296,7 +305,7 @@
|
||||
:settings-page/enable-tooltip "ツールチップ"
|
||||
:settings-page/enable-journals "日誌"
|
||||
:settings-page/enable-all-pages-public "パブリッシュ時には全てのページを公開する"
|
||||
:settings-page/home-default-page "デフォルトのホームページを設定"
|
||||
:settings-page/home-default-page "起動時のホームページを設定"
|
||||
:settings-page/clear-cache "キャッシュをクリア"
|
||||
:settings-page/clear "クリア"
|
||||
:settings-page/clear-cache-warning "キャッシュをクリアすると、開いているグラフは破棄されます。保存されていない変更は失われます。"
|
||||
@@ -305,6 +314,7 @@
|
||||
:settings-page/current-version "現在のバージョン"
|
||||
:settings-page/tab-general "一般"
|
||||
:settings-page/tab-editor "エディタ"
|
||||
:settings-page/tab-keymap "キーマップ"
|
||||
:settings-page/tab-version-control "バージョンコントロール"
|
||||
:settings-page/tab-account "アカウント"
|
||||
:settings-page/tab-advanced "高度な設定"
|
||||
@@ -316,7 +326,7 @@
|
||||
:settings-page/filename-format "ファイル名の書式"
|
||||
:settings-page/alpha-features "アルファ機能"
|
||||
:settings-page/beta-features "ベータ機能"
|
||||
:settings-page/login-prompt "新しい機能を誰よりも早く使いたい場合は、LogseqのOpen Collective Sponsorか後援者になって上で、ログインしてください。"
|
||||
:settings-page/login-prompt "新しい機能を誰よりも早く使いたい場合は、LogseqのOpen Collective Sponsorか後援者になった上で、ログインしてください。"
|
||||
:settings-page/sync "Sync(同期)"
|
||||
:settings-page/sync-desc-1 "Syncを設定し、使うための手引きを見るには、"
|
||||
:settings-page/sync-desc-2 "ここ"
|
||||
@@ -337,6 +347,8 @@
|
||||
:settings-page/update-error-2 "次のリンクをご確認ください:"
|
||||
:settings-permission/start-granting "認証"
|
||||
|
||||
:settings-page/auto-chmod "ファイルの権限を自動で変更する"
|
||||
:settings-page/auto-chmod-desc "グループ メンバーシップを用いて、複数人のユーザに編集を許可する権限を与えたい場合、この機能を無効にしてください。"
|
||||
:yes "はい"
|
||||
|
||||
:submit "投稿"
|
||||
@@ -445,6 +457,7 @@
|
||||
:whiteboard/dashboard-card-edited "編集:"
|
||||
:whiteboard/toggle-grid "格子の表示/非表示"
|
||||
:whiteboard/snap-to-grid "図形を格子に合わせる"
|
||||
:whiteboard/toggle-pen-mode "ペンモードを切り替える"
|
||||
:flashcards/modal-welcome-title "フラッシュカードを作成する時間です!"
|
||||
:flashcards/modal-welcome-desc-1 "ブロックに「#card」を追加することでカードとすることができます。また、「/cloze」で穴埋めを追加できます。"
|
||||
:flashcards/modal-welcome-desc-2 "ドキュメントを見るには、"
|
||||
@@ -605,6 +618,7 @@
|
||||
:file-sync/other-user-graph "現在のローカルグラフは他のユーザーのリモートグラフにバインドされています。同期を開始できません。"
|
||||
:file-sync/graph-deleted "現在のリモートグラフが削除されました"
|
||||
:file-sync/rsapi-cannot-upload-err "同期が始まらない場合、お使いのコンピュータの時間が正しいか確認してください。"
|
||||
:file-sync/connectivity-testing-failed "ネットワーク接続のテストに失敗しました。ネットワークの設定を確認してください。テストのURLは以下になります:"
|
||||
|
||||
:notification/clear-all "全てクリア"
|
||||
|
||||
@@ -618,6 +632,20 @@
|
||||
:shortcut.category/whiteboard "ホワイトボード"
|
||||
:shortcut.category/others "その他"
|
||||
:shortcut.category/plugins "プラグイン"
|
||||
|
||||
:keymap/all "全て"
|
||||
:keymap/disabled "無効"
|
||||
:keymap/unset "未定義"
|
||||
:keymap/custom "カスタム"
|
||||
:keymap/search "検索"
|
||||
:keymap/total "ショートカット数:"
|
||||
:keymap/keystroke-filter "キーを打鍵して絞り込む"
|
||||
:keymap/keystroke-record-desc "キーの列を順に押してください。ショートカットを絞り込みます。"
|
||||
:keymap/keystroke-record-setup-label "ショートカットにセットしたいキーの列を順に押してください。"
|
||||
:keymap/restore-to-default "システムの既定値に戻す"
|
||||
:keymap/customize-for-label "ショートカットをカスタマイズ"
|
||||
:keymap/conflicts-for-label "キーマップが衝突しています:"
|
||||
|
||||
:window/minimize "最小化"
|
||||
:window/maximize "最大化"
|
||||
:window/restore "復元"
|
||||
@@ -677,7 +705,7 @@
|
||||
:command.editor/replace-block-reference-at-point "この場所でブロック参照をそのコンテンツで置き換え"
|
||||
:command.editor/paste-text-in-one-block-at-point "カーソル位置へ文字列として貼り付け"
|
||||
:command.editor/insert-youtube-timestamp "YouTubeのタイプスタンプを挿入"
|
||||
:command.editor/cycle-todo "現在の項目の TODO 状態をローテートさせる"
|
||||
:command.editor/cycle-todo "現在の項目の TODO 状態を循環させる"
|
||||
:command.editor/up "カーソル上移動 / 上を選択"
|
||||
:command.editor/down "カーソル下移動 / 下を選択"
|
||||
:command.editor/left "カーソル左移動 / 左を選択"
|
||||
@@ -735,6 +763,8 @@
|
||||
:command.go/electron-jump-to-the-next "文字列検索で次を検索"
|
||||
:command.go/electron-jump-to-the-previous "文字列検索で前を検索"
|
||||
:command.go/search "検索"
|
||||
:command.command-palette/toggle "検索コマンド"
|
||||
:command.go/search-in-page "ページ内のブロックを検索"
|
||||
:command.go/journals "日誌"
|
||||
:command.go/backward "戻る"
|
||||
:command.go/forward "前へ"
|
||||
@@ -767,8 +797,11 @@
|
||||
:command.ui/toggle-help "ヘルプの表示/非表示"
|
||||
:command.ui/toggle-theme "テーマの切り替え"
|
||||
:command.ui/toggle-contents "目次の開閉"
|
||||
:command.ui/cycle-color-off "循環させた色を元に戻す"
|
||||
:command.ui/cycle-color "色を循環させる"
|
||||
|
||||
:command.command/toggle-favorite "お気に入りへ追加/削除"
|
||||
:command.editor/open-file-in-default-app "ファイルを規定のアプリで開く"
|
||||
:command.editor/open-file-in-default-app "ファイルを既定のアプリで開く"
|
||||
:command.editor/open-file-in-directory "ファイルをディレクトリで開く"
|
||||
:command.editor/copy-current-file "現在のファイルをコピー"
|
||||
:command.editor/copy-page-url "ページのURLをコピー"
|
||||
@@ -782,4 +815,5 @@
|
||||
:command.dev/show-block-data "(開発) ブロックのデータを表示"
|
||||
:command.dev/show-block-ast "(開発) ブロックの抽象構文木の表示"
|
||||
:command.dev/show-page-data "(開発) ページのデータを表示"
|
||||
:command.dev/show-page-ast "(開発) ページの抽象構文木の表示"}
|
||||
:command.dev/show-page-ast "(開発) ページの抽象構文木の表示"
|
||||
:command.window/close "ウィンドウを閉じる"}
|
||||
|
||||
Reference in New Issue
Block a user