mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: block uuid changed when embedding a page or a block
This commit is contained in:
@@ -405,13 +405,15 @@
|
||||
|
||||
(defn- assign-temp-id
|
||||
[blocks replace-empty-target? target-block]
|
||||
(map-indexed (fn [idx block]
|
||||
;; TODO: block uuid changed, this could be a problem for rtc
|
||||
(let [replacing-block? (and replace-empty-target? (zero? idx))
|
||||
db-id (if replacing-block?
|
||||
(:db/id target-block)
|
||||
(dec (- idx)))]
|
||||
(assoc block :db/id db-id))) blocks))
|
||||
(->> (map-indexed (fn [idx block]
|
||||
(let [replacing-block? (and replace-empty-target? (zero? idx))]
|
||||
(if replacing-block?
|
||||
[[:db/retractEntity (:db/id target-block)] ; retract target-block first
|
||||
(assoc block
|
||||
:db/id (or (:db/id block) (dec (- idx)))
|
||||
:block/left (:db/id (:block/left target-block)))]
|
||||
[(assoc block :db/id (dec (- idx)))]))) blocks)
|
||||
(apply concat)))
|
||||
|
||||
(defn- find-outdented-block-prev-hop
|
||||
[outdented-block blocks]
|
||||
|
||||
Reference in New Issue
Block a user