mirror of
https://github.com/logseq/logseq.git
synced 2026-04-25 14:44:53 +00:00
refactor: separate og and db version (#12276)
separate og and new version apps remove file sync, tldraw, excalidraw and zotero
This commit is contained in:
@@ -27,17 +27,15 @@ and handles unexpected failure."
|
||||
:db (db/get-db repo)
|
||||
:date-formatter (state/get-date-formatter)
|
||||
:page-name page-name
|
||||
:db-graph-mode? (config/db-based-graph? repo)})]
|
||||
(if (config/db-based-graph? repo)
|
||||
(map (fn [block]
|
||||
(cond-> (dissoc block :block/format :block/properties :block/macros :block/properties-order)
|
||||
(:block/properties block)
|
||||
(merge (update-keys (:block/properties block)
|
||||
(fn [k]
|
||||
(or ({:heading :logseq.property/heading} k)
|
||||
(throw (ex-info (str "Don't know how to save graph-parser property " (pr-str k)) {}))))))))
|
||||
blocks)
|
||||
blocks))
|
||||
:db-graph-mode? true})]
|
||||
(map (fn [block]
|
||||
(cond-> (dissoc block :block/format :block/properties :block/macros :block/properties-order)
|
||||
(:block/properties block)
|
||||
(merge (update-keys (:block/properties block)
|
||||
(fn [k]
|
||||
(or ({:heading :logseq.property/heading} k)
|
||||
(throw (ex-info (str "Don't know how to save graph-parser property " (pr-str k)) {}))))))))
|
||||
blocks))
|
||||
(catch :default e
|
||||
(log/error :exception e)
|
||||
(state/pub-event! [:capture-error {:error e
|
||||
@@ -80,9 +78,7 @@ and handles unexpected failure."
|
||||
parse-config (mldoc/get-default-config format)
|
||||
;; Disable extraction for display-type blocks as there isn't a reason to have
|
||||
;; it enabled yet and can cause visible bugs when '#' is used
|
||||
db-based? (config/db-based-graph? (state/get-current-repo))
|
||||
blocks (if (and db-based?
|
||||
(:logseq.property.node/display-type block))
|
||||
blocks (if (:logseq.property.node/display-type block)
|
||||
[block]
|
||||
(let [ast (format/to-edn title format parse-config)]
|
||||
(extract-blocks ast title format {})))
|
||||
@@ -90,7 +86,7 @@ and handles unexpected failure."
|
||||
block (cond-> (merge block new-block)
|
||||
(> (count blocks) 1)
|
||||
(assoc :block/warning :multiple-blocks)
|
||||
db-based?
|
||||
true
|
||||
(dissoc :block/format))
|
||||
block (dissoc block :block.temp/ast-body :block/level)]
|
||||
(if uuid (assoc block :block/uuid uuid) block))))
|
||||
|
||||
Reference in New Issue
Block a user