fix: page refs not saved in quick capture

This commit is contained in:
Tienson Qin
2025-08-25 20:49:48 +08:00
parent f44fdeb2ea
commit 0696a556d9
3 changed files with 31 additions and 28 deletions

View File

@@ -718,15 +718,17 @@
(if-let [eid (or (:db/id b)
(when-let [id (:block/uuid b)]
[:block/uuid id]))]
(->
(if-let [e (if (de/entity? b) b (d/entity db eid))]
(merge
(into {} e)
{:db/id (:db/id e)
:block/title (or (:block/raw-title e) (:block/title e))}
b)
b)
(dissoc :block/tx-id :block/refs :block/path-refs))
(let [b (if-let [e (if (de/entity? b) b (d/entity db eid))]
(merge
(into {} e)
{:db/id (:db/id e)
:block/title (or (:block/raw-title e) (:block/title e))}
b)
b)
dissoc-keys (concat [:block/tx-id :block/path-refs]
(when (contains? #{:insert-template-blocks :paste} outliner-op)
[:block/refs]))]
(apply dissoc b dissoc-keys))
b))
blocks)
[target-block sibling?] (get-target-block db blocks target-block opts)

View File

@@ -597,31 +597,31 @@
(wrap-parse-block)
(assoc :block/uuid (or custom-uuid (db/new-block-id))))
new-block (merge new-block other-attrs)
[block-m sibling?] (cond
before?
(let [left-or-parent (or (ldb/get-left-sibling block)
(:block/parent block))
sibling? (if (= (:db/id (:block/parent block)) (:db/id left-or-parent))
false sibling?)]
[left-or-parent sibling?])
[target-block sibling?] (cond
before?
(let [left-or-parent (or (ldb/get-left-sibling block)
(:block/parent block))
sibling? (if (= (:db/id (:block/parent block)) (:db/id left-or-parent))
false sibling?)]
[left-or-parent sibling?])
sibling?
[(db/entity (:db/id block)) sibling?]
sibling?
[(db/entity (:db/id block)) sibling?]
last-block
[last-block true]
last-block
[last-block true]
block
[(db/entity (:db/id block)) sibling?]
block
[(db/entity (:db/id block)) sibling?]
;; FIXME: assert
:else
nil)]
(when block-m
;; FIXME: assert
:else
nil)]
(when target-block
(p/do!
(ui-outliner-tx/transact!
{:outliner-op :insert-blocks}
(outliner-insert-block! config block-m new-block
(outliner-insert-block! config target-block new-block
{:sibling? sibling?
:keep-uuid? true
:ordered-list? ordered-list?

View File

@@ -93,7 +93,8 @@
(let [result (outliner-core/insert-blocks
repo db template-blocks object
{:sibling? false
:keep-uuid? journal-template?})]
:keep-uuid? journal-template?
:outliner-op :insert-template-blocks})]
(:tx-data result)))))))]
tx-data))