fix: page title shouldn't be blank

This commit is contained in:
Tienson Qin
2024-08-27 21:14:13 +08:00
parent 4dff1a42c1
commit 4859ecd7ea
4 changed files with 15 additions and 9 deletions

View File

@@ -1102,12 +1102,14 @@
(let [repo (state/get-current-repo)
block-uuids (distinct (map #(uuid (dom/attr % "blockid")) dom-blocks))
lookup-refs (map (fn [id] [:block/uuid id]) block-uuids)
blocks (db/pull-many repo '[*] lookup-refs)
top-level-blocks (block-handler/get-top-level-blocks blocks)
blocks (->> (map db/entity lookup-refs)
(remove ldb/page?))
top-level-blocks (when (seq blocks) (block-handler/get-top-level-blocks blocks))
sorted-blocks (mapcat (fn [block]
(tree/get-sorted-block-and-children repo (:db/id block)))
top-level-blocks)]
(delete-blocks! repo (map :block/uuid sorted-blocks) sorted-blocks dom-blocks))))))
(when (seq sorted-blocks)
(delete-blocks! repo (map :block/uuid sorted-blocks) sorted-blocks dom-blocks)))))))
(def url-regex
"Didn't use link/plain-link as it is incorrectly detects words as urls."