mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 10:56:32 +00:00
Merge branch 'master' into disable-webview-resize
This commit is contained in:
@@ -64,8 +64,9 @@
|
||||
:ui/settings-open? false
|
||||
:ui/sidebar-open? false
|
||||
:ui/left-sidebar-open? (boolean (storage/get "ls-left-sidebar-open?"))
|
||||
:ui/theme (or (storage/get :ui/theme) (if (mobile-util/native-platform?) "light" "dark"))
|
||||
:ui/theme (or (storage/get :ui/theme) "light")
|
||||
:ui/system-theme? ((fnil identity (or util/mac? util/win32? false)) (storage/get :ui/system-theme?))
|
||||
:ui/custom-theme (or (storage/get :ui/custom-theme) {:light {:mode "light"} :dark {:mode "dark"}})
|
||||
:ui/wide-mode? (storage/get :ui/wide-mode)
|
||||
|
||||
;; ui/collapsed-blocks is to separate the collapse/expand state from db for:
|
||||
@@ -222,6 +223,8 @@
|
||||
:file-sync/sync-uploading-files nil
|
||||
:file-sync/sync-downloading-files nil
|
||||
|
||||
:file-sync/download-init-progress nil
|
||||
|
||||
:encryption/graph-parsing? false
|
||||
})))
|
||||
|
||||
@@ -885,30 +888,45 @@
|
||||
(set-edit-content! edit-input-id content)
|
||||
(set-state! [:editor/last-saved-cursor (:block/uuid (get-edit-block))] new-pos)))
|
||||
|
||||
(defn set-theme!
|
||||
[theme]
|
||||
(set-state! :ui/theme theme)
|
||||
(defn set-theme-mode!
|
||||
[mode]
|
||||
(when (mobile-util/native-ios?)
|
||||
(if (= theme "light")
|
||||
(if (= mode "light")
|
||||
(util/set-theme-light)
|
||||
(util/set-theme-dark)))
|
||||
(storage/set :ui/theme theme))
|
||||
(set-state! :ui/theme mode)
|
||||
(storage/set :ui/theme mode))
|
||||
|
||||
(defn sync-system-theme!
|
||||
[]
|
||||
(let [system-dark? (.-matches (js/window.matchMedia "(prefers-color-scheme: dark)"))]
|
||||
(set-theme! (if system-dark? "dark" "light"))
|
||||
(set-theme-mode! (if system-dark? "dark" "light"))
|
||||
(set-state! :ui/system-theme? true)
|
||||
(storage/set :ui/system-theme? true)))
|
||||
|
||||
(defn use-theme-mode!
|
||||
[theme-mode]
|
||||
(if-not (= theme-mode "system")
|
||||
(if (= theme-mode "system")
|
||||
(sync-system-theme!)
|
||||
(do
|
||||
(set-theme! theme-mode)
|
||||
(set-theme-mode! theme-mode)
|
||||
(set-state! :ui/system-theme? false)
|
||||
(storage/set :ui/system-theme? false))
|
||||
(sync-system-theme!)))
|
||||
(storage/set :ui/system-theme? false))))
|
||||
|
||||
(defn toggle-theme
|
||||
[theme]
|
||||
(if (= theme "dark") "light" "dark"))
|
||||
|
||||
(defn toggle-theme!
|
||||
[]
|
||||
(use-theme-mode! (toggle-theme (:ui/theme @state))))
|
||||
|
||||
(defn set-custom-theme!
|
||||
([custom-theme]
|
||||
(set-custom-theme! nil custom-theme))
|
||||
([mode theme]
|
||||
(set-state! (if mode [:ui/custom-theme (keyword mode)] :ui/custom-theme) theme)
|
||||
(storage/set :ui/custom-theme (:ui/custom-theme @state))))
|
||||
|
||||
(defn set-editing-block-dom-id!
|
||||
[block-dom-id]
|
||||
@@ -918,12 +936,6 @@
|
||||
[]
|
||||
(:editor/block-dom-id @state))
|
||||
|
||||
(defn toggle-theme!
|
||||
[]
|
||||
(let [theme (:ui/theme @state)
|
||||
theme' (if (= theme "dark") "light" "dark")]
|
||||
(use-theme-mode! theme')))
|
||||
|
||||
(defn set-root-component!
|
||||
[component]
|
||||
(set-state! :ui/root-component component))
|
||||
@@ -1664,6 +1676,20 @@
|
||||
(defn get-file-sync-state []
|
||||
(:file-sync/sync-state @state))
|
||||
|
||||
(defn reset-file-sync-download-init-state!
|
||||
[]
|
||||
(set-state! [:file-sync/download-init-progress (get-current-repo)] {}))
|
||||
|
||||
(defn set-file-sync-download-init-state!
|
||||
[m]
|
||||
(update-state! [:file-sync/download-init-progress (get-current-repo)]
|
||||
(if (fn? m) m
|
||||
(fn [old-value] (merge old-value m)))))
|
||||
|
||||
(defn get-file-sync-download-init-state
|
||||
[]
|
||||
(get-in @state [:file-sync/download-init-progress (get-current-repo)]))
|
||||
|
||||
(defn reset-parsing-state!
|
||||
[]
|
||||
(set-state! [:graph/parsing-state (get-current-repo)] {}))
|
||||
|
||||
Reference in New Issue
Block a user