mirror of https://github.com/logseq/logseq
Merge branch 'master' into enhance/graph-parser-part-four
commit
b74b64bc8b
|
@ -81,7 +81,7 @@
|
||||||
(.unregisterProtocol protocol FILE_LSP_SCHEME)
|
(.unregisterProtocol protocol FILE_LSP_SCHEME)
|
||||||
(.unregisterProtocol protocol "assets")))
|
(.unregisterProtocol protocol "assets")))
|
||||||
|
|
||||||
(defn- handle-export-publish-assets [_event html custom-css-path repo-path asset-filenames output-path]
|
(defn- handle-export-publish-assets [_event html custom-css-path export-css-path repo-path asset-filenames output-path]
|
||||||
(p/let [app-path (. app getAppPath)
|
(p/let [app-path (. app getAppPath)
|
||||||
asset-filenames (js->clj asset-filenames)
|
asset-filenames (js->clj asset-filenames)
|
||||||
root-dir (or output-path (handler/open-dir-dialog))]
|
root-dir (or output-path (handler/open-dir-dialog))]
|
||||||
|
@ -89,7 +89,8 @@
|
||||||
(let [static-dir (path/join root-dir "static")
|
(let [static-dir (path/join root-dir "static")
|
||||||
assets-from-dir (path/join repo-path "assets")
|
assets-from-dir (path/join repo-path "assets")
|
||||||
assets-to-dir (path/join root-dir "assets")
|
assets-to-dir (path/join root-dir "assets")
|
||||||
index-html-path (path/join root-dir "index.html")]
|
index-html-path (path/join root-dir "index.html")
|
||||||
|
export-or-custom-css-path (if (fs/existsSync export-css-path) export-css-path custom-css-path)]
|
||||||
(p/let [_ (. fs ensureDir static-dir)
|
(p/let [_ (. fs ensureDir static-dir)
|
||||||
_ (. fs ensureDir assets-to-dir)
|
_ (. fs ensureDir assets-to-dir)
|
||||||
_ (p/all (concat
|
_ (p/all (concat
|
||||||
|
@ -111,8 +112,8 @@
|
||||||
(fn [part]
|
(fn [part]
|
||||||
(. fs copy (path/join app-path part) (path/join static-dir part)))
|
(. fs copy (path/join app-path part) (path/join static-dir part)))
|
||||||
["css" "fonts" "icons" "img" "js"])))
|
["css" "fonts" "icons" "img" "js"])))
|
||||||
custom-css (. fs readFile custom-css-path)
|
export-css (. fs readFile export-or-custom-css-path)
|
||||||
_ (. fs writeFile (path/join static-dir "css" "custom.css") custom-css)
|
_ (. fs writeFile (path/join static-dir "css" "export.css") export-css)
|
||||||
js-files ["main.js" "code-editor.js" "excalidraw.js"]
|
js-files ["main.js" "code-editor.js" "excalidraw.js"]
|
||||||
_ (p/all (map (fn [file]
|
_ (p/all (map (fn [file]
|
||||||
(. fs removeSync (path/join static-dir "js" file)))
|
(. fs removeSync (path/join static-dir "js" file)))
|
||||||
|
|
|
@ -525,6 +525,7 @@
|
||||||
|
|
||||||
(when (= (state/sub :editor/record-status) "RECORDING")
|
(when (= (state/sub :editor/record-status) "RECORDING")
|
||||||
[:div#audio-record-toolbar
|
[:div#audio-record-toolbar
|
||||||
|
{:style {:bottom (+ @util/keyboard-height 45)}}
|
||||||
(footer/audio-record-cp)])
|
(footer/audio-record-cp)])
|
||||||
|
|
||||||
(ui/ls-textarea
|
(ui/ls-textarea
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#audio-record-toolbar {
|
#audio-record-toolbar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
background-color: var(--ls-secondary-background-color);
|
background-color: var(--ls-secondary-background-color);
|
||||||
bottom: 45px;
|
|
||||||
width: 88px;
|
width: 88px;
|
||||||
justify-content: left;
|
justify-content: left;
|
||||||
left: 5px;
|
left: 5px;
|
||||||
|
|
|
@ -151,6 +151,14 @@
|
||||||
:on-click #(js/setTimeout (fn [] (ui-handler/toggle-settings-modal!)))
|
:on-click #(js/setTimeout (fn [] (ui-handler/toggle-settings-modal!)))
|
||||||
:-for "customize_css"}))
|
:-for "customize_css"}))
|
||||||
|
|
||||||
|
(defn edit-export-css []
|
||||||
|
(row-with-button-action
|
||||||
|
{:left-label (t :settings-page/export-theme)
|
||||||
|
:button-label (t :settings-page/edit-export-css)
|
||||||
|
:href (rfe/href :file {:path (config/get-export-css-path)})
|
||||||
|
:on-click #(js/setTimeout (fn [] (ui-handler/toggle-settings-modal!)))
|
||||||
|
:-for "customize_css"}))
|
||||||
|
|
||||||
(defn show-brackets-row [t show-brackets?]
|
(defn show-brackets-row [t show-brackets?]
|
||||||
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
|
[:div.it.sm:grid.sm:grid-cols-3.sm:gap-4.sm:items-start
|
||||||
[:label.block.text-sm.font-medium.leading-5.opacity-70
|
[:label.block.text-sm.font-medium.leading-5.opacity-70
|
||||||
|
@ -518,6 +526,7 @@
|
||||||
(theme-modes-row t switch-theme system-theme? dark?)
|
(theme-modes-row t switch-theme system-theme? dark?)
|
||||||
(when current-repo (edit-config-edn))
|
(when current-repo (edit-config-edn))
|
||||||
(when current-repo (edit-custom-css))
|
(when current-repo (edit-custom-css))
|
||||||
|
(when current-repo (edit-export-css))
|
||||||
(keyboard-shortcuts-row t)]))
|
(keyboard-shortcuts-row t)]))
|
||||||
|
|
||||||
(rum/defcs settings-editor < rum/reactive
|
(rum/defcs settings-editor < rum/reactive
|
||||||
|
|
|
@ -243,6 +243,7 @@
|
||||||
(defonce recycle-dir ".recycle")
|
(defonce recycle-dir ".recycle")
|
||||||
(def config-file "config.edn")
|
(def config-file "config.edn")
|
||||||
(def custom-css-file "custom.css")
|
(def custom-css-file "custom.css")
|
||||||
|
(def export-css-file "export.css")
|
||||||
(def custom-js-file "custom.js")
|
(def custom-js-file "custom.js")
|
||||||
(def metadata-file "metadata.edn")
|
(def metadata-file "metadata.edn")
|
||||||
(def pages-metadata-file "pages-metadata.edn")
|
(def pages-metadata-file "pages-metadata.edn")
|
||||||
|
@ -359,6 +360,15 @@
|
||||||
(get-file-path repo
|
(get-file-path repo
|
||||||
(str app-name "/" custom-css-file)))))
|
(str app-name "/" custom-css-file)))))
|
||||||
|
|
||||||
|
(defn get-export-css-path
|
||||||
|
([]
|
||||||
|
(get-export-css-path (state/get-current-repo)))
|
||||||
|
([repo]
|
||||||
|
(when repo
|
||||||
|
(get-file-path repo
|
||||||
|
(str app-name "/" export-css-file)))))
|
||||||
|
|
||||||
|
|
||||||
(defn get-custom-js-path
|
(defn get-custom-js-path
|
||||||
([]
|
([]
|
||||||
(get-custom-js-path (state/get-current-repo)))
|
(get-custom-js-path (state/get-current-repo)))
|
||||||
|
|
|
@ -147,8 +147,10 @@
|
||||||
:settings-page/git-commit-delay "Git auto commit seconds"
|
:settings-page/git-commit-delay "Git auto commit seconds"
|
||||||
:settings-page/edit-config-edn "Edit config.edn"
|
:settings-page/edit-config-edn "Edit config.edn"
|
||||||
:settings-page/edit-custom-css "Edit custom.css"
|
:settings-page/edit-custom-css "Edit custom.css"
|
||||||
|
:settings-page/edit-export-css "Edit export.css"
|
||||||
:settings-page/custom-configuration "Custom configuration"
|
:settings-page/custom-configuration "Custom configuration"
|
||||||
:settings-page/custom-theme "Custom theme"
|
:settings-page/custom-theme "Custom theme"
|
||||||
|
:settings-page/export-theme "Export theme"
|
||||||
:settings-page/show-brackets "Show brackets"
|
:settings-page/show-brackets "Show brackets"
|
||||||
:settings-page/spell-checker "Spell checker"
|
:settings-page/spell-checker "Spell checker"
|
||||||
:settings-page/auto-updater "Auto updater"
|
:settings-page/auto-updater "Auto updater"
|
||||||
|
|
|
@ -2,46 +2,47 @@
|
||||||
(:refer-clojure :exclude [run!])
|
(:refer-clojure :exclude [run!])
|
||||||
(:require [clojure.core.async :as async]
|
(:require [clojure.core.async :as async]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
[frontend.context.i18n :refer [t]]
|
[clojure.string :as string]
|
||||||
|
[frontend.commands :as commands]
|
||||||
[frontend.components.diff :as diff]
|
[frontend.components.diff :as diff]
|
||||||
[frontend.handler.plugin :as plugin-handler]
|
[frontend.components.encryption :as encryption]
|
||||||
[frontend.fs.capacitor-fs :as capacitor-fs]
|
|
||||||
[frontend.components.plugins :as plugin]
|
|
||||||
[frontend.components.git :as git-component]
|
[frontend.components.git :as git-component]
|
||||||
[frontend.components.shell :as shell]
|
[frontend.components.plugins :as plugin]
|
||||||
[frontend.components.search :as search]
|
[frontend.components.search :as search]
|
||||||
|
[frontend.components.shell :as shell]
|
||||||
[frontend.config :as config]
|
[frontend.config :as config]
|
||||||
|
[frontend.context.i18n :refer [t]]
|
||||||
[frontend.db :as db]
|
[frontend.db :as db]
|
||||||
[logseq.graph-parser.db.schema :as db-schema]
|
[logseq.graph-parser.db.schema :as db-schema]
|
||||||
|
[frontend.encrypt :as encrypt]
|
||||||
[frontend.extensions.srs :as srs]
|
[frontend.extensions.srs :as srs]
|
||||||
|
[frontend.fs :as fs]
|
||||||
|
[frontend.fs.capacitor-fs :as capacitor-fs]
|
||||||
[frontend.fs.nfs :as nfs]
|
[frontend.fs.nfs :as nfs]
|
||||||
|
[frontend.fs.sync :as sync]
|
||||||
[frontend.fs.watcher-handler :as fs-watcher]
|
[frontend.fs.watcher-handler :as fs-watcher]
|
||||||
[frontend.handler.common :as common-handler]
|
[frontend.handler.common :as common-handler]
|
||||||
[frontend.handler.editor :as editor-handler]
|
[frontend.handler.editor :as editor-handler]
|
||||||
|
[frontend.handler.file :as file-handler]
|
||||||
[frontend.handler.notification :as notification]
|
[frontend.handler.notification :as notification]
|
||||||
[frontend.handler.page :as page-handler]
|
[frontend.handler.page :as page-handler]
|
||||||
|
[frontend.handler.plugin :as plugin-handler]
|
||||||
|
[frontend.handler.repo :as repo-handler]
|
||||||
|
[frontend.handler.route :as route-handler]
|
||||||
[frontend.handler.search :as search-handler]
|
[frontend.handler.search :as search-handler]
|
||||||
[frontend.handler.ui :as ui-handler]
|
[frontend.handler.ui :as ui-handler]
|
||||||
[frontend.handler.repo :as repo-handler]
|
|
||||||
[frontend.handler.file :as file-handler]
|
|
||||||
[frontend.handler.route :as route-handler]
|
|
||||||
[frontend.handler.web.nfs :as nfs-handler]
|
[frontend.handler.web.nfs :as nfs-handler]
|
||||||
[frontend.modules.shortcut.core :as st]
|
[frontend.mobile.util :as mobile-util]
|
||||||
|
[frontend.modules.instrumentation.posthog :as posthog]
|
||||||
[frontend.modules.outliner.file :as outliner-file]
|
[frontend.modules.outliner.file :as outliner-file]
|
||||||
[frontend.commands :as commands]
|
[frontend.modules.shortcut.core :as st]
|
||||||
[frontend.state :as state]
|
[frontend.state :as state]
|
||||||
[frontend.ui :as ui]
|
[frontend.ui :as ui]
|
||||||
[frontend.util :as util]
|
[frontend.util :as util]
|
||||||
[rum.core :as rum]
|
|
||||||
[frontend.modules.instrumentation.posthog :as posthog]
|
|
||||||
[frontend.mobile.util :as mobile-util]
|
|
||||||
[promesa.core :as p]
|
|
||||||
[frontend.fs :as fs]
|
|
||||||
[clojure.string :as string]
|
|
||||||
[frontend.util.persist-var :as persist-var]
|
[frontend.util.persist-var :as persist-var]
|
||||||
[frontend.fs.sync :as sync]
|
[goog.dom :as gdom]
|
||||||
[frontend.components.encryption :as encryption]
|
[promesa.core :as p]
|
||||||
[frontend.encrypt :as encrypt]))
|
[rum.core :as rum]))
|
||||||
|
|
||||||
;; TODO: should we move all events here?
|
;; TODO: should we move all events here?
|
||||||
|
|
||||||
|
@ -296,8 +297,15 @@
|
||||||
(when (mobile-util/native-ios?)
|
(when (mobile-util/native-ios?)
|
||||||
(reset! util/keyboard-height keyboard-height)
|
(reset! util/keyboard-height keyboard-height)
|
||||||
(set! (.. main-node -style -marginBottom) (str keyboard-height "px"))
|
(set! (.. main-node -style -marginBottom) (str keyboard-height "px"))
|
||||||
|
(when-let [left-sidebar-node (gdom/getElement "left-sidebar")]
|
||||||
|
(set! (.. left-sidebar-node -style -bottom) (str keyboard-height "px")))
|
||||||
|
(when-let [right-sidebar-node (gdom/getElementByClass "sidebar-item-list")]
|
||||||
|
(set! (.. right-sidebar-node -style -paddingBottom) (str (+ 150 keyboard-height) "px")))
|
||||||
(when-let [card-preview-el (js/document.querySelector ".cards-review")]
|
(when-let [card-preview-el (js/document.querySelector ".cards-review")]
|
||||||
(set! (.. card-preview-el -style -marginBottom) (str keyboard-height "px")))
|
(set! (.. card-preview-el -style -marginBottom) (str keyboard-height "px")))
|
||||||
|
(when (= (state/sub :editor/record-status) "RECORDING")
|
||||||
|
(when-let [record-node (gdom/getElement "audio-record-toolbar")]
|
||||||
|
(set! (.. record-node -style -bottom) (str (+ 45 keyboard-height) "px"))))
|
||||||
(js/setTimeout (fn []
|
(js/setTimeout (fn []
|
||||||
(let [toolbar (.querySelector main-node "#mobile-editor-toolbar")]
|
(let [toolbar (.querySelector main-node "#mobile-editor-toolbar")]
|
||||||
(set! (.. toolbar -style -bottom) (str keyboard-height "px"))))
|
(set! (.. toolbar -style -bottom) (str keyboard-height "px"))))
|
||||||
|
@ -310,7 +318,14 @@
|
||||||
(when (mobile-util/native-ios?)
|
(when (mobile-util/native-ios?)
|
||||||
(when-let [card-preview-el (js/document.querySelector ".cards-review")]
|
(when-let [card-preview-el (js/document.querySelector ".cards-review")]
|
||||||
(set! (.. card-preview-el -style -marginBottom) "0px"))
|
(set! (.. card-preview-el -style -marginBottom) "0px"))
|
||||||
(set! (.. main-node -style -marginBottom) "0px"))))
|
(set! (.. main-node -style -marginBottom) "0px")
|
||||||
|
(when-let [left-sidebar-node (gdom/getElement "left-sidebar")]
|
||||||
|
(set! (.. left-sidebar-node -style -bottom) "0px"))
|
||||||
|
(when-let [right-sidebar-node (gdom/getElementByClass "sidebar-item-list")]
|
||||||
|
(set! (.. right-sidebar-node -style -paddingBottom) "150px"))
|
||||||
|
(when (= (state/sub :editor/record-status) "RECORDING")
|
||||||
|
(when-let [record-node (gdom/getElement "audio-record-toolbar")]
|
||||||
|
(set! (.. record-node -style -bottom) "45px"))))))
|
||||||
|
|
||||||
(defmethod handle :plugin/consume-updates [[_ id pending? updated?]]
|
(defmethod handle :plugin/consume-updates [[_ id pending? updated?]]
|
||||||
(let [downloading? (:plugin/updates-downloading? @state/state)]
|
(let [downloading? (:plugin/updates-downloading? @state/state)]
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
(js/window.apis.exportPublishAssets
|
(js/window.apis.exportPublishAssets
|
||||||
raw-html-str
|
raw-html-str
|
||||||
(config/get-custom-css-path)
|
(config/get-custom-css-path)
|
||||||
|
(config/get-export-css-path)
|
||||||
(config/get-repo-dir repo)
|
(config/get-repo-dir repo)
|
||||||
(clj->js asset-filenames)
|
(clj->js asset-filenames)
|
||||||
(util/mocked-open-dir-path))
|
(util/mocked-open-dir-path))
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
(editor-handler/remove-block-property! uuid :heading)
|
(editor-handler/remove-block-property! uuid :heading)
|
||||||
(editor-handler/set-block-property! uuid :heading true)))))
|
(editor-handler/set-block-property! uuid :heading true)))))
|
||||||
(action-command "infinity" "Card" #(srs/make-block-a-card! (:block/uuid block)))
|
(action-command "infinity" "Card" #(srs/make-block-a-card! (:block/uuid block)))
|
||||||
(action-command "copy" "Copy" #(editor-handler/copy-selection-blocks))
|
(action-command "copy" "Copy" #(editor-handler/copy-selection-blocks false))
|
||||||
(action-command "cut" "Cut" #(editor-handler/cut-selection-blocks true))
|
(action-command "cut" "Cut" #(editor-handler/cut-selection-blocks true))
|
||||||
(action-command "trash" "Delete" #(editor-handler/delete-block-aux! block true))
|
(action-command "trash" "Delete" #(editor-handler/delete-block-aux! block true))
|
||||||
(action-command "registered" "Copy ref"
|
(action-command "registered" "Copy ref"
|
||||||
|
|
|
@ -43,7 +43,10 @@
|
||||||
(reset! *record-start -1)
|
(reset! *record-start -1)
|
||||||
(mobile-bar-command record/start-recording "microphone"))
|
(mobile-bar-command record/start-recording "microphone"))
|
||||||
[:div.flex.flex-row.items-center
|
[:div.flex.flex-row.items-center
|
||||||
(mobile-bar-command record/stop-recording "player-stop")
|
(mobile-bar-command #(do
|
||||||
|
(record/stop-recording)
|
||||||
|
(reset! *record-start -1))
|
||||||
|
"player-stop")
|
||||||
[:div.timer.pl-2
|
[:div.timer.pl-2
|
||||||
{:on-click record/stop-recording}
|
{:on-click record/stop-recording}
|
||||||
(seconds->minutes:seconds @*record-start)]]))
|
(seconds->minutes:seconds @*record-start)]]))
|
||||||
|
|
|
@ -102,7 +102,6 @@
|
||||||
(command #(do (viewport-fn) (commands/simple-insert! parent-id "#" {})) "tag" true)
|
(command #(do (viewport-fn) (commands/simple-insert! parent-id "#" {})) "tag" true)
|
||||||
(command editor-handler/cycle-priority! "a-b" true)
|
(command editor-handler/cycle-priority! "a-b" true)
|
||||||
(command editor-handler/toggle-list! "list" true)
|
(command editor-handler/toggle-list! "list" true)
|
||||||
(command editor-handler/toggle-list! "list" true)
|
|
||||||
(command #(mobile-camera/embed-photo parent-id) "camera" true)
|
(command #(mobile-camera/embed-photo parent-id) "camera" true)
|
||||||
(command record/start-recording "microphone" true)
|
(command record/start-recording "microphone" true)
|
||||||
(command commands/insert-youtube-timestamp "brand-youtube" true)
|
(command commands/insert-youtube-timestamp "brand-youtube" true)
|
||||||
|
|
|
@ -56,12 +56,15 @@
|
||||||
(log/error :file/write-failed {:path path
|
(log/error :file/write-failed {:path path
|
||||||
:error error})))
|
:error error})))
|
||||||
url (util/format "../assets/%s" filename)
|
url (util/format "../assets/%s" filename)
|
||||||
file-link (editor-handler/get-asset-file-link format url filename true)]
|
file-link (editor-handler/get-asset-file-link format url filename true)
|
||||||
|
args (merge (if (parse-uuid page)
|
||||||
|
{:block-uuid (uuid page)}
|
||||||
|
{:page page})
|
||||||
|
{:edit-block? false
|
||||||
|
:replace-empty-target? true})]
|
||||||
(if edit-block
|
(if edit-block
|
||||||
(state/append-current-edit-content! file-link)
|
(state/append-current-edit-content! file-link)
|
||||||
(editor-handler/api-insert-new-block! file-link {:page page
|
(editor-handler/api-insert-new-block! file-link args))))
|
||||||
:edit-block? false
|
|
||||||
:replace-empty-target? true}))))
|
|
||||||
|
|
||||||
(defn stop-recording []
|
(defn stop-recording []
|
||||||
(p/catch
|
(p/catch
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
:name "viewport"}]
|
:name "viewport"}]
|
||||||
[:link {:type "text/css", :href "static/css/tabler-icons.min.css", :rel "stylesheet"}]
|
[:link {:type "text/css", :href "static/css/tabler-icons.min.css", :rel "stylesheet"}]
|
||||||
[:link {:type "text/css", :href "static/css/style.css", :rel "stylesheet"}]
|
[:link {:type "text/css", :href "static/css/style.css", :rel "stylesheet"}]
|
||||||
[:link {:type "text/css", :href "static/css/custom.css", :rel "stylesheet"}]
|
[:link {:type "text/css", :href "static/css/export.css", :rel "stylesheet"}]
|
||||||
[:link
|
[:link
|
||||||
{:href icon
|
{:href icon
|
||||||
:type "image/png",
|
:type "image/png",
|
||||||
|
|
Loading…
Reference in New Issue