fix: update :block/page when moving between pages

pull/11293/head
Tienson Qin 2024-04-19 20:16:39 +08:00
parent 113ff4e669
commit 20006eafa8
1 changed files with 8 additions and 5 deletions

View File

@ -1023,12 +1023,15 @@
first-block-page (:db/id (:block/page block))
target-page (or (:db/id (:block/page target-block))
(:db/id target-block))
tx-data [{:db/id (:db/id block)
:block/left (:db/id target-block)
:block/parent (if sibling?
(:db/id (:block/parent target-block))
(:db/id target-block))}]
not-same-page? (not= first-block-page target-page)
tx-data [(cond->
{:db/id (:db/id block)
:block/left (:db/id target-block)
:block/parent (if sibling?
(:db/id (:block/parent target-block))
(:db/id target-block))}
not-same-page?
(assoc :block/page target-page))]
move-blocks-next-tx (build-move-block-next-tx db block target-block sibling?)
children-page-tx (when not-same-page?
(let [children-ids (ldb/get-block-children-ids db (:block/uuid block))]