mirror of https://github.com/logseq/logseq
Merge branch 'master' into feat/custom-children-list-style
commit
0449ee6bdc
|
@ -51,7 +51,6 @@ startup.png
|
||||||
/src/test/docs*
|
/src/test/docs*
|
||||||
~*~
|
~*~
|
||||||
|
|
||||||
ios/App/App/capacitor.config.json
|
|
||||||
android/app/src/main/assets/capacitor.config.json
|
android/app/src/main/assets/capacitor.config.json
|
||||||
|
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
|
|
|
@ -131,13 +131,10 @@
|
||||||
[?b :block/properties ?prop]
|
[?b :block/properties ?prop]
|
||||||
[(missing? $ ?b :block/name)]
|
[(missing? $ ?b :block/name)]
|
||||||
[(get ?prop ?key) ?v]
|
[(get ?prop ?key) ?v]
|
||||||
(or-join [?v]
|
[(str ?val) ?str-val]
|
||||||
[(= ?v ?val)]
|
(or [(= ?v ?val)]
|
||||||
[(contains? ?v ?val)]
|
[(contains? ?v ?val)]
|
||||||
;; For integer pages that aren't strings
|
[(contains? ?v ?str-val)])]
|
||||||
(and
|
|
||||||
[(str ?val) ?str-val]
|
|
||||||
[(contains? ?v ?str-val)]))]
|
|
||||||
|
|
||||||
:page-ref
|
:page-ref
|
||||||
'[(page-ref ?b ?page-name)
|
'[(page-ref ?b ?page-name)
|
||||||
|
|
|
@ -174,9 +174,6 @@
|
||||||
(name k))
|
(name k))
|
||||||
v'
|
v'
|
||||||
|
|
||||||
(string/blank? v')
|
|
||||||
nil
|
|
||||||
|
|
||||||
(gp-util/wrapped-by-quotes? v')
|
(gp-util/wrapped-by-quotes? v')
|
||||||
v'
|
v'
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
[frontend.db.model :as model]
|
[frontend.db.model :as model]
|
||||||
[frontend.handler.common :as common-handler]
|
[frontend.handler.common :as common-handler]
|
||||||
[frontend.handler.route :as route-handler]
|
[frontend.handler.route :as route-handler]
|
||||||
[frontend.handler.config :as config-handler]
|
|
||||||
[frontend.handler.whiteboard :as whiteboard-handler]
|
[frontend.handler.whiteboard :as whiteboard-handler]
|
||||||
[frontend.rum :refer [use-bounding-client-rect use-breakpoint
|
[frontend.rum :refer [use-bounding-client-rect use-breakpoint
|
||||||
use-click-outside]]
|
use-click-outside]]
|
||||||
|
@ -311,7 +310,6 @@
|
||||||
(ui/button (t :on-boarding/welcome-whiteboard-modal-skip) :on-click close-fn :background "gray" :class "opacity-60")
|
(ui/button (t :on-boarding/welcome-whiteboard-modal-skip) :on-click close-fn :background "gray" :class "opacity-60")
|
||||||
(ui/button (t :on-boarding/welcome-whiteboard-modal-start)
|
(ui/button (t :on-boarding/welcome-whiteboard-modal-start)
|
||||||
:on-click (fn []
|
:on-click (fn []
|
||||||
(config-handler/set-config! :feature/enable-whiteboards? true)
|
|
||||||
(quick-tour/ready
|
(quick-tour/ready
|
||||||
(fn []
|
(fn []
|
||||||
(quick-tour/start-whiteboard)
|
(quick-tour/start-whiteboard)
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
[logseq.common.path :as path]
|
[logseq.common.path :as path]
|
||||||
[logseq.graph-parser.config :as gp-config]
|
[logseq.graph-parser.config :as gp-config]
|
||||||
[logseq.graph-parser.util :as gp-util]
|
[logseq.graph-parser.util :as gp-util]
|
||||||
[shadow.resource :as rc]))
|
[shadow.resource :as rc]
|
||||||
|
[goog.crypt.Md5]
|
||||||
|
[goog.crypt :as crypt]))
|
||||||
|
|
||||||
(goog-define DEV-RELEASE false)
|
(goog-define DEV-RELEASE false)
|
||||||
(defonce dev-release? DEV-RELEASE)
|
(defonce dev-release? DEV-RELEASE)
|
||||||
|
@ -338,6 +340,9 @@
|
||||||
(def export-css-file "export.css")
|
(def export-css-file "export.css")
|
||||||
(def custom-js-file "custom.js")
|
(def custom-js-file "custom.js")
|
||||||
(def config-default-content (rc/inline "config.edn"))
|
(def config-default-content (rc/inline "config.edn"))
|
||||||
|
(def config-default-content-md5 (let [md5 (new crypt/Md5)]
|
||||||
|
(.update md5 (crypt/stringToUtf8ByteArray config-default-content))
|
||||||
|
(crypt/byteArrayToHex (.digest md5))))
|
||||||
|
|
||||||
;; NOTE: repo-url is the unique identifier of a repo.
|
;; NOTE: repo-url is the unique identifier of a repo.
|
||||||
;; - `local` => in-memory demo graph
|
;; - `local` => in-memory demo graph
|
||||||
|
|
|
@ -592,10 +592,16 @@
|
||||||
"when diff all remote files and local files, following remote files always need to download(when checksum not matched),
|
"when diff all remote files and local files, following remote files always need to download(when checksum not matched),
|
||||||
even local-file's last-modified > remote-file's last-modified.
|
even local-file's last-modified > remote-file's last-modified.
|
||||||
because these files will be auto created when the graph created, we dont want them to re-write related remote files."
|
because these files will be auto created when the graph created, we dont want them to re-write related remote files."
|
||||||
#{"logseq/config.edn" "logseq/custom.css"
|
#{"pages/contents.md" "pages/contents.org"
|
||||||
"pages/contents.md" "pages/contents.org"
|
|
||||||
"logseq/metadata.edn"})
|
"logseq/metadata.edn"})
|
||||||
|
|
||||||
|
(def ^:private ignore-default-value-files
|
||||||
|
"when create a new local graph, some files will be created (config.edn, custom.css).
|
||||||
|
And related remote files wins if these files have default template value."
|
||||||
|
#{"logseq/config.edn" "logseq/custom.css"})
|
||||||
|
|
||||||
|
(def ^:private empty-custom-css-md5 "d41d8cd98f00b204e9800998ecf8427e")
|
||||||
|
|
||||||
;; TODO: use fn some to filter FileMetadata here, it cause too much loop
|
;; TODO: use fn some to filter FileMetadata here, it cause too much loop
|
||||||
(defn diff-file-metadata-sets
|
(defn diff-file-metadata-sets
|
||||||
"Find the `FileMetadata`s that exists in s1 and does not exist in s2,
|
"Find the `FileMetadata`s that exists in s1 and does not exist in s2,
|
||||||
|
@ -605,29 +611,33 @@
|
||||||
keep this `FileMetadata` in result"
|
keep this `FileMetadata` in result"
|
||||||
[s1 s2]
|
[s1 s2]
|
||||||
(reduce
|
(reduce
|
||||||
(fn [result item]
|
(fn [result item]
|
||||||
(let [path (:path item)
|
(let [path (:path item)
|
||||||
lower-case-path (some-> path string/lower-case)
|
lower-case-path (some-> path string/lower-case)
|
||||||
;; encrypted-path (:encrypted-path item)
|
;; encrypted-path (:encrypted-path item)
|
||||||
checksum (:etag item)
|
checksum (:etag item)
|
||||||
last-modified (:last-modified item)]
|
last-modified (:last-modified item)]
|
||||||
(if (some
|
(if (some
|
||||||
#(cond
|
#(cond
|
||||||
(not= lower-case-path (some-> (:path %) string/lower-case))
|
(not= lower-case-path (some-> (:path %) string/lower-case))
|
||||||
false
|
false
|
||||||
(= checksum (:etag %))
|
(= checksum (:etag %))
|
||||||
true
|
true
|
||||||
(>= last-modified (:last-modified %))
|
(>= last-modified (:last-modified %))
|
||||||
false
|
false
|
||||||
;; these special files have higher priority in s1
|
;; these special files have higher priority in s1
|
||||||
(contains? higher-priority-remote-files path)
|
(contains? higher-priority-remote-files path)
|
||||||
false
|
false
|
||||||
(< last-modified (:last-modified %))
|
;; higher priority in s1 when config.edn=default value or empty custom.css
|
||||||
true)
|
(and (contains? ignore-default-value-files path)
|
||||||
s2)
|
(#{config/config-default-content-md5 empty-custom-css-md5} (:etag %)))
|
||||||
result
|
false
|
||||||
(conj result item))))
|
(< last-modified (:last-modified %))
|
||||||
#{} s1))
|
true)
|
||||||
|
s2)
|
||||||
|
result
|
||||||
|
(conj result item))))
|
||||||
|
#{} s1))
|
||||||
|
|
||||||
(comment
|
(comment
|
||||||
(defn map->FileMetadata [m]
|
(defn map->FileMetadata [m]
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
[frontend.fs.watcher-handler :as fs-watcher]
|
[frontend.fs.watcher-handler :as fs-watcher]
|
||||||
[frontend.handler.command-palette :as cp]
|
[frontend.handler.command-palette :as cp]
|
||||||
[frontend.handler.common :as common-handler]
|
[frontend.handler.common :as common-handler]
|
||||||
[frontend.handler.config :as config-handler]
|
|
||||||
[frontend.handler.editor :as editor-handler]
|
[frontend.handler.editor :as editor-handler]
|
||||||
[frontend.handler.file :as file-handler]
|
[frontend.handler.file :as file-handler]
|
||||||
[frontend.handler.file-sync :as file-sync-handler]
|
[frontend.handler.file-sync :as file-sync-handler]
|
||||||
|
@ -89,10 +88,7 @@
|
||||||
(defn- enable-beta-features!
|
(defn- enable-beta-features!
|
||||||
[]
|
[]
|
||||||
(when-not (false? (state/enable-sync?)) ; user turns it off
|
(when-not (false? (state/enable-sync?)) ; user turns it off
|
||||||
(file-sync-handler/set-sync-enabled! true))
|
(file-sync-handler/set-sync-enabled! true)))
|
||||||
|
|
||||||
(when-not (false? (state/enable-whiteboards?))
|
|
||||||
(config-handler/set-config! :feature/enable-whiteboards? true)))
|
|
||||||
|
|
||||||
(defmethod handle :user/fetch-info-and-graphs [[_]]
|
(defmethod handle :user/fetch-info-and-graphs [[_]]
|
||||||
(state/set-state! [:ui/loading? :login] false)
|
(state/set-state! [:ui/loading? :login] false)
|
||||||
|
|
|
@ -45,13 +45,13 @@
|
||||||
[line]
|
[line]
|
||||||
(boolean
|
(boolean
|
||||||
(and (string? line)
|
(and (string? line)
|
||||||
(re-find (re-pattern (str "^\\s?[^ ]+" gp-property/colons " ")) line))))
|
(re-find (re-pattern (str "^\\s?[^ ]+" gp-property/colons)) line))))
|
||||||
|
|
||||||
(defn front-matter-property?
|
(defn front-matter-property?
|
||||||
[line]
|
[line]
|
||||||
(boolean
|
(boolean
|
||||||
(and (string? line)
|
(and (string? line)
|
||||||
(util/safe-re-find #"^\s*[^ ]+: " line))))
|
(util/safe-re-find #"^\s*[^ ]+:" line))))
|
||||||
|
|
||||||
(defn get-property-key
|
(defn get-property-key
|
||||||
[line format]
|
[line format]
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
(is (= {:title 98
|
(is (= {:title 98
|
||||||
:alias 6
|
:alias 6
|
||||||
:tags 2 :permalink 2
|
:tags 3 :permalink 2
|
||||||
:name 1 :type 1 :related 1 :sample 1 :click 1 :id 1 :example 1}
|
:name 1 :type 1 :related 1 :sample 1 :click 1 :id 1 :example 1}
|
||||||
(docs-graph-helper/get-all-page-properties db))
|
(docs-graph-helper/get-all-page-properties db))
|
||||||
"Counts for all page properties")
|
"Counts for all page properties")
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
"** hello"
|
"** hello"
|
||||||
|
|
||||||
(property/remove-properties :markdown "** hello\nx:: y\na::b\n")
|
(property/remove-properties :markdown "** hello\nx:: y\na::b\n")
|
||||||
"** hello\na::b"))
|
"** hello"))
|
||||||
|
|
||||||
(testing "properties with blank lines"
|
(testing "properties with blank lines"
|
||||||
(are [x y] (= x y)
|
(are [x y] (= x y)
|
||||||
|
@ -152,7 +152,19 @@ SCHEDULED: <2021-10-25 Mon>\n:PROPERTIES:\n:a: b\n:END:\nworld\n" "c" "d")
|
||||||
"a\nfoo:: [[bar]], [[baz]]\nb"
|
"a\nfoo:: [[bar]], [[baz]]\nb"
|
||||||
|
|
||||||
(property/insert-properties :markdown "" {:foo "\"bar, baz\""})
|
(property/insert-properties :markdown "" {:foo "\"bar, baz\""})
|
||||||
"foo:: \"bar, baz\""))
|
"foo:: \"bar, baz\""
|
||||||
|
|
||||||
|
(property/insert-properties :markdown "abcd\nempty::" {:id "123" :foo "bar"})
|
||||||
|
"abcd\nempty::\nid:: 123\nfoo:: bar"
|
||||||
|
|
||||||
|
(property/insert-properties :markdown "abcd\nempty:: " {:id "123" :foo "bar"})
|
||||||
|
"abcd\nempty:: \nid:: 123\nfoo:: bar"
|
||||||
|
|
||||||
|
(property/insert-properties :markdown "abcd\nempty::" {:id "123"})
|
||||||
|
"abcd\nempty::\nid:: 123"
|
||||||
|
|
||||||
|
(property/insert-properties :markdown "abcd\nempty::\nanother-empty::" {:id "123"})
|
||||||
|
"abcd\nempty::\nanother-empty::\nid:: 123"))
|
||||||
|
|
||||||
(deftest test-build-properties-str
|
(deftest test-build-properties-str
|
||||||
(are [x y] (= (property/build-properties-str :mardown x) y)
|
(are [x y] (= (property/build-properties-str :mardown x) y)
|
||||||
|
|
Loading…
Reference in New Issue