mirror of
https://github.com/logseq/logseq.git
synced 2026-04-25 22:54:48 +00:00
fix: macros were not being saved
macros were being discarded as unknown blocks when they should've been saved as a block with a known type. Introduced a new type number as macros don't have most of the attributes that blocks or pages do. Features like collapsible queries now work in db graphs. Also removed an outdated reference that assumed macro was a page (which it no longer is)
This commit is contained in:
@@ -14,25 +14,34 @@
|
||||
[frontend.handler.property.util :as pu]
|
||||
[lambdaisland.glogi :as log]
|
||||
[frontend.util :as util]
|
||||
[datascript.core :as d]
|
||||
[logseq.db.frontend.property :as db-property]))
|
||||
|
||||
(defn- update-extracted-block-properties
|
||||
"Updates DB graph blocks to ensure that built-in properties are using uuids
|
||||
for property ids"
|
||||
[blocks]
|
||||
(let [repo (state/get-current-repo)]
|
||||
(if (config/db-based-graph? repo)
|
||||
(map (fn [b]
|
||||
(if (:block/properties b)
|
||||
(-> b
|
||||
(dissoc :block/properties-order)
|
||||
(update :block/properties
|
||||
(fn [props]
|
||||
(let [repo (state/get-current-repo)
|
||||
update-properties (fn [props]
|
||||
(update-keys props #(if (contains? db-property/built-in-properties-keys %)
|
||||
(pu/get-built-in-property-uuid repo %)
|
||||
%)))))
|
||||
b))
|
||||
blocks)
|
||||
%)))]
|
||||
(if (config/db-based-graph? repo)
|
||||
(->> blocks
|
||||
(map (fn [b]
|
||||
(if (:block/properties b)
|
||||
(-> b
|
||||
(dissoc :block/properties-order)
|
||||
(update :block/properties update-properties))
|
||||
b)))
|
||||
(map (fn [b]
|
||||
(if (:block/macros b)
|
||||
(update b :block/macros
|
||||
(fn [macros]
|
||||
(map #(-> %
|
||||
(assoc :block/uuid (d/squuid))
|
||||
(update :block/properties update-properties)) macros)))
|
||||
b))))
|
||||
blocks)))
|
||||
|
||||
(defn extract-blocks
|
||||
|
||||
Reference in New Issue
Block a user