mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 10:56:32 +00:00
Merge remote-tracking branch 'upstream/master' into whiteboards
This commit is contained in:
@@ -14,13 +14,14 @@
|
||||
[frontend.handler.ui :as ui-handler]
|
||||
[frontend.handler.user :as user-handler]
|
||||
[frontend.handler.plugin :as plugin-handler]
|
||||
[frontend.handler.file-sync :as file-sync-handler]
|
||||
[frontend.modules.instrumentation.core :as instrument]
|
||||
[frontend.modules.shortcut.data-helper :as shortcut-helper]
|
||||
[frontend.state :as state]
|
||||
[frontend.ui :as ui]
|
||||
[electron.ipc :as ipc]
|
||||
[promesa.core :as p]
|
||||
[frontend.util :refer [classnames] :as util]
|
||||
[frontend.util :refer [classnames web-platform?] :as util]
|
||||
[frontend.version :refer [version]]
|
||||
[goog.object :as gobj]
|
||||
[reitit.frontend.easy :as rfe]
|
||||
@@ -374,7 +375,7 @@
|
||||
:else
|
||||
(notification/show! (str "The page \"" value "\" doesn't exist yet. Please create that page first, and then try again.") :warning))))
|
||||
|
||||
(defn journal-row [t enable-journals?]
|
||||
(defn journal-row [enable-journals?]
|
||||
(toggle "enable_journals"
|
||||
(t :settings-page/enable-journals)
|
||||
enable-journals?
|
||||
@@ -398,7 +399,7 @@
|
||||
;; (let [value (not enable-block-timestamps?)]
|
||||
;; (config-handler/set-config! :feature/enable-block-timestamps? value)))))
|
||||
|
||||
(defn encryption-row [t enable-encryption?]
|
||||
(defn encryption-row [enable-encryption?]
|
||||
(toggle "enable_encryption"
|
||||
(t :settings-page/enable-encryption)
|
||||
enable-encryption?
|
||||
@@ -423,15 +424,15 @@
|
||||
(route-handler/redirect! {:to :shortcut-setting}))
|
||||
:-for "customize_shortcuts"}))
|
||||
|
||||
(defn zotero-settings-row [_t]
|
||||
(defn zotero-settings-row []
|
||||
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
|
||||
[:label.block.text-sm.font-medium.leading-5.opacity-70
|
||||
{:for "zotero_settings"}
|
||||
"Zotero settings"]
|
||||
"Zotero"]
|
||||
[:div.mt-1.sm:mt-0.sm:col-span-2
|
||||
[:div
|
||||
(ui/button
|
||||
"Zotero settings"
|
||||
"Settings"
|
||||
:class "text-sm p-1"
|
||||
:style {:margin-top "0px"}
|
||||
:on-click
|
||||
@@ -561,8 +562,6 @@
|
||||
preferred-date-format (state/get-date-formatter)
|
||||
preferred-workflow (state/get-preferred-workflow)
|
||||
enable-timetracking? (state/enable-timetracking?)
|
||||
enable-journals? (state/enable-journals? current-repo)
|
||||
enable-encryption? (state/enable-encryption? current-repo)
|
||||
enable-all-pages-public? (state/all-pages-public?)
|
||||
logical-outdenting? (state/logical-outdenting?)
|
||||
enable-tooltip? (state/enable-tooltip?)
|
||||
@@ -583,23 +582,7 @@
|
||||
(when-not (or (util/mobile?) (mobile-util/native-platform?))
|
||||
(tooltip-row t enable-tooltip?))
|
||||
(timetracking-row t enable-timetracking?)
|
||||
(journal-row t enable-journals?)
|
||||
(when (not enable-journals?)
|
||||
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
|
||||
[:label.block.text-sm.font-medium.leading-5.opacity-70
|
||||
{:for "default page"}
|
||||
(t :settings-page/home-default-page)]
|
||||
[:div.mt-1.sm:mt-0.sm:col-span-2
|
||||
[:div.max-w-lg.rounded-md.sm:max-w-xs
|
||||
[:input#home-default-page.form-input.is-small.transition.duration-150.ease-in-out
|
||||
{:default-value (state/sub-default-home-page)
|
||||
:on-blur update-home-page
|
||||
:on-key-press (fn [e]
|
||||
(when (= "Enter" (util/ekey e))
|
||||
(update-home-page e)))}]]]])
|
||||
(encryption-row t enable-encryption?)
|
||||
(enable-all-pages-public-row t enable-all-pages-public?)
|
||||
(zotero-settings-row t)
|
||||
(auto-push-row t current-repo enable-git-auto-push?)]))
|
||||
|
||||
(rum/defc settings-git
|
||||
@@ -623,18 +606,15 @@
|
||||
[:p (t :settings-page/git-confirm)])])
|
||||
|
||||
(rum/defc settings-advanced < rum/reactive
|
||||
[current-repo]
|
||||
[]
|
||||
(let [instrument-disabled? (state/sub :instrument/disabled?)
|
||||
developer-mode? (state/sub [:ui/developer-mode?])
|
||||
https-agent-opts (state/sub [:electron/user-cfgs :settings/agent])
|
||||
enable-flashcards? (state/enable-flashcards? current-repo)
|
||||
enable-whiteboards? (state/enable-whiteboards? current-repo)]
|
||||
enable-whiteboards? (state/enable-whiteboards? (state/get-current-repo))]
|
||||
[:div.panel-wrap.is-advanced
|
||||
(when (and util/mac? (util/electron?)) (app-auto-update-row t))
|
||||
(usage-diagnostics-row t instrument-disabled?)
|
||||
(when-not (mobile-util/native-platform?) (developer-mode-row t developer-mode?))
|
||||
(when (and (util/electron?) config/enable-plugins?) (plugin-system-switcher-row))
|
||||
(flashcards-switcher-row enable-flashcards?)
|
||||
(when (util/electron?) (whiteboards-switcher-row enable-whiteboards?))
|
||||
(when (util/electron?) (https-user-agent-row https-agent-opts))
|
||||
(clear-cache-row t)
|
||||
@@ -643,6 +623,53 @@
|
||||
:warning
|
||||
[:p "Clearing the cache will discard open graphs. You will lose unsaved changes."])]))
|
||||
|
||||
(rum/defc sync-enabled-switcher
|
||||
[enabled?]
|
||||
(ui/toggle enabled?
|
||||
(fn []
|
||||
(let [value (not enabled?)]
|
||||
(storage/set :logseq-sync-enabled value)
|
||||
(state/set-state! :feature/enable-sync? value)))
|
||||
true))
|
||||
|
||||
(defn sync-switcher-row [enabled?]
|
||||
(row-with-button-action
|
||||
{:left-label (str (t :settings-page/sync) " 🔐")
|
||||
:action (sync-enabled-switcher enabled?)}))
|
||||
|
||||
(rum/defc settings-features < rum/reactive
|
||||
[]
|
||||
(let [current-repo (state/get-current-repo)
|
||||
enable-journals? (state/enable-journals? current-repo)
|
||||
enable-encryption? (state/enable-encryption? current-repo)
|
||||
enable-flashcards? (state/enable-flashcards? current-repo)
|
||||
enable-sync? (state/enable-sync?)]
|
||||
[:div.panel-wrap.is-features.mb-8
|
||||
(journal-row enable-journals?)
|
||||
(when (not enable-journals?)
|
||||
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
|
||||
[:label.block.text-sm.font-medium.leading-5.opacity-70
|
||||
{:for "default page"}
|
||||
(t :settings-page/home-default-page)]
|
||||
[:div.mt-1.sm:mt-0.sm:col-span-2
|
||||
[:div.max-w-lg.rounded-md.sm:max-w-xs
|
||||
[:input#home-default-page.form-input.is-small.transition.duration-150.ease-in-out
|
||||
{:default-value (state/sub-default-home-page)
|
||||
:on-blur update-home-page
|
||||
:on-key-press (fn [e]
|
||||
(when (= "Enter" (util/ekey e))
|
||||
(update-home-page e)))}]]]])
|
||||
(when (and (util/electron?) config/enable-plugins?) (plugin-system-switcher-row))
|
||||
(flashcards-switcher-row enable-flashcards?)
|
||||
(zotero-settings-row)
|
||||
(encryption-row enable-encryption?)
|
||||
|
||||
(when-not web-platform?
|
||||
[:div
|
||||
[:hr]
|
||||
[:h2.mb-4 "Alpha test (sponsors only)"]
|
||||
(sync-switcher-row enable-sync?)])]))
|
||||
|
||||
(rum/defcs settings
|
||||
< (rum/local [:general :general] ::active)
|
||||
{:will-mount
|
||||
@@ -665,16 +692,20 @@
|
||||
[:header
|
||||
[:h1.title (t :settings)]]
|
||||
|
||||
[:div.cp__settings-inner.md:flex
|
||||
[:div.cp__settings-inner
|
||||
|
||||
[:aside.md:w-64 {:style {:min-width "10rem"}}
|
||||
[:ul.settings-menu
|
||||
(for [[label id text icon]
|
||||
[[:general "general" (t :settings-page/tab-general) (ui/icon "adjustments" {:style {:font-size 20}})]
|
||||
[:editor "editor" (t :settings-page/tab-editor) (ui/icon "writing" {:style {:font-size 20}})]
|
||||
(when-not (mobile-util/native-platform?)
|
||||
(when (and
|
||||
(util/electron?)
|
||||
(not (file-sync-handler/synced-file-graph? current-repo)))
|
||||
[:git "git" (t :settings-page/tab-version-control) (ui/icon "history" {:style {:font-size 20}})])
|
||||
[:advanced "advanced" (t :settings-page/tab-advanced) (ui/icon "bulb" {:style {:font-size 20}})]
|
||||
[:features "features" (t :settings-page/tab-features) (ui/icon "app-feature" {:style {:font-size 20}
|
||||
:extension? true})]
|
||||
(when plugins-of-settings
|
||||
[:plugins-setting "plugins" (t :settings-of-plugins) (ui/icon "puzzle")])]]
|
||||
|
||||
@@ -709,6 +740,9 @@
|
||||
(settings-git)
|
||||
|
||||
:advanced
|
||||
(settings-advanced current-repo)
|
||||
(settings-advanced)
|
||||
|
||||
:features
|
||||
(settings-features)
|
||||
|
||||
nil)]]]))
|
||||
|
||||
Reference in New Issue
Block a user