mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 01:46:35 +00:00
feat: add block timestamps
Why adding block timestamps? Block is the atomic unit for logseq instead of a page, with the timestamps we can do a lot of things, for example: 1. show a blocks timeline related to a topic/project/habit. 2. get latest modified blocks from the page or the whole graph. 3. query dsl can have a (sort-by :last_modified_at) clause It'll add both created_at and last_modified_at properties to each block, not all users need this, so, it's an experiment feature, we'll disable it by default. Also, this PR simplify the block properties a lot, it might fix some old issues related to properties.
This commit is contained in:
@@ -134,6 +134,12 @@
|
||||
(= "List" (first block))
|
||||
(:name (first (second block)))))
|
||||
|
||||
(defn- ->schema-properties
|
||||
[properties]
|
||||
(-> properties
|
||||
(update "created_at" util/safe-parse-int)
|
||||
(update "last_modified_at" util/safe-parse-int)))
|
||||
|
||||
(defn extract-properties
|
||||
[[_ properties] start-pos end-pos]
|
||||
(let [properties (->> (into {} properties)
|
||||
@@ -146,7 +152,7 @@
|
||||
(util/safe-parse-int v')
|
||||
v')]
|
||||
[k' v']))))]
|
||||
{:properties properties
|
||||
{:properties (->schema-properties properties)
|
||||
:start-pos start-pos
|
||||
:end-pos end-pos}))
|
||||
|
||||
@@ -379,7 +385,7 @@
|
||||
block
|
||||
{:block/meta meta
|
||||
:block/marker (get block :block/marker "nil")
|
||||
:block/properties (get block :block/properties [])
|
||||
:block/properties (get block :block/properties {})
|
||||
:block/file file
|
||||
:block/format format
|
||||
:block/page page
|
||||
|
||||
Reference in New Issue
Block a user