mirror of
https://github.com/logseq/logseq.git
synced 2026-04-27 15:45:00 +00:00
fix: markdown tables didn't recognize built-in v2 properties
also fix enum values not usable for api fn
This commit is contained in:
@@ -65,4 +65,20 @@
|
||||
(defn enum-value
|
||||
"Given an enum ent and the value's uuid, return the value's string"
|
||||
[ent value-uuid]
|
||||
(get-in ent [:block/schema :enum-config :values value-uuid :name]))
|
||||
(get-in ent [:block/schema :enum-config :values value-uuid :name]))
|
||||
|
||||
(defn readable-properties
|
||||
"Given a DB graph's properties, returns a readable properties map with keys as
|
||||
property names and property values dereferenced where possible. A property's
|
||||
value will only be a uuid if it's a page or a block"
|
||||
[properties]
|
||||
(->> properties
|
||||
(map (fn [[k v]]
|
||||
(let [prop-ent (db/entity [:block/uuid k])]
|
||||
[(-> prop-ent
|
||||
:block/name
|
||||
keyword)
|
||||
(if (= :enum (get-in prop-ent [:block/schema :type]))
|
||||
(enum-value prop-ent v)
|
||||
v)])))
|
||||
(into {})))
|
||||
Reference in New Issue
Block a user