mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 18:06:32 +00:00
fix(api): insert as first child when current node is first child
This commit is contained in:
@@ -707,8 +707,13 @@
|
||||
(assoc :block/uuid (or custom-uuid (db/new-block-id))))
|
||||
[block-m sibling?] (cond
|
||||
before?
|
||||
(let [block (db/pull (:db/id (:block/left block)))
|
||||
sibling? (if (:block/name block) false sibling?)]
|
||||
(let [first-child? (->> [:block/parent :block/left]
|
||||
(map #(:db/id (get block %)))
|
||||
(apply =))
|
||||
block (db/pull (:db/id (:block/left block)))
|
||||
sibling? (if (or first-child? ;; insert as first child
|
||||
(:block/name block))
|
||||
false sibling?)]
|
||||
[block sibling?])
|
||||
|
||||
sibling?
|
||||
|
||||
Reference in New Issue
Block a user