fix: delete untitled pages

This commit is contained in:
Tienson Qin
2025-06-16 15:23:41 +08:00
parent 73db9a2ac8
commit 2b3e712762
3 changed files with 7 additions and 3 deletions

View File

@@ -2451,6 +2451,9 @@
db (db/get-db)
query? (ldb/class-instance? (entity-plus/entity-memoized db :logseq.class/Query) block')]
(cond
(and (:page-title? config) (ldb/page? block) (string/blank? (:block/title block)))
[:div.opacity-75 "Untitled"]
(:raw-title? config)
(text-block-title (dissoc config :raw-title?) block)

View File

@@ -26,5 +26,6 @@
(filter db/page?)
(remove ldb/hidden?)
(remove (fn [e]
(and (ldb/property? e)
(true? (:logseq.property/hide? e)))))))
(or (and (ldb/property? e)
(true? (:logseq.property/hide? e)))
(string/blank? (:block/title e)))))))

View File

@@ -1057,7 +1057,7 @@
lookup-refs (map (fn [id] [:block/uuid id]) block-uuids)
blocks (map db/entity lookup-refs)
pages (filter ldb/page? blocks)
pages-with-parent (filter :block/parent pages)]
pages-with-parent (filter (fn [page] (and (:block/parent page) (not (string/blank? (:block/title page))))) pages)]
(ui-outliner-tx/transact!
{:outliner-op :delete-blocks}
(doseq [page pages-with-parent]