Fase B2: give Contents root semantics alongside Library
Adds a shared common-config/contents-page-name constant and ldb/contents?/get-contents-page, mirroring the existing Library helpers. Contents already qualifies as an internal page, so the existing namespace-title split mechanism (e.g. "Contents/Proyectos") already parents pages under it via :block/parent, coexisting with Library rather than replacing it as the default root.
This commit is contained in:
1
deps/common/src/logseq/common/config.cljs
vendored
1
deps/common/src/logseq/common/config.cljs
vendored
@@ -59,6 +59,7 @@
|
||||
(defonce favorites-page-name "$$$favorites")
|
||||
(defonce views-page-name "$$$views")
|
||||
(defonce library-page-name "Library")
|
||||
(defonce contents-page-name "Contents")
|
||||
(defonce quick-add-page-name "Quick add")
|
||||
(defonce recycle-page-name "Recycle")
|
||||
|
||||
|
||||
5
deps/db/src/logseq/db.cljs
vendored
5
deps/db/src/logseq/db.cljs
vendored
@@ -577,6 +577,11 @@
|
||||
[db]
|
||||
(get-built-in-page db common-config/library-page-name))
|
||||
|
||||
(def contents? db-db/contents?)
|
||||
(defn get-contents-page
|
||||
[db]
|
||||
(get-built-in-page db common-config/contents-page-name))
|
||||
|
||||
(defn get-case-page
|
||||
"Case sensitive version of get-page. For use with DB graphs"
|
||||
[db page-name-or-uuid]
|
||||
|
||||
@@ -431,7 +431,7 @@
|
||||
structured-datoms (get-structured-datoms db)
|
||||
user-datoms (get-all-user-datoms db)
|
||||
list-style-datoms (get-list-style-values db)
|
||||
pages-datoms (let [contents-id (get-first-page-by-title db "Contents")
|
||||
pages-datoms (let [contents-id (get-first-page-by-title db common-config/contents-page-name)
|
||||
capture-page-id (:db/id (db-db/get-built-in-page db common-config/quick-add-page-name))
|
||||
views-id (get-first-page-by-title db common-config/views-page-name)
|
||||
recycle-id (get-first-page-by-title db "Recycle")]
|
||||
|
||||
8
deps/db/src/logseq/db/frontend/db.cljs
vendored
8
deps/db/src/logseq/db/frontend/db.cljs
vendored
@@ -139,3 +139,11 @@
|
||||
[page]
|
||||
(and (entity-util/built-in? page)
|
||||
(= common-config/library-page-name (:block/title page))))
|
||||
|
||||
(defn contents?
|
||||
"Whether `page` is the built-in Contents page, the other hierarchical
|
||||
root pages can be explicitly organized under (coexists with Library,
|
||||
which remains the default root for namespaced pages)."
|
||||
[page]
|
||||
(and (entity-util/built-in? page)
|
||||
(= common-config/contents-page-name (:block/title page))))
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
(def built-in-pages-names
|
||||
#{common-config/library-page-name
|
||||
common-config/quick-add-page-name
|
||||
"Contents"})
|
||||
common-config/contents-page-name})
|
||||
|
||||
(defn- validate-tx-for-duplicate-idents [tx]
|
||||
(when-let [conflicting-idents
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
[frontend.undo-redo.debug-ui :as undo-redo-debug-ui]
|
||||
[frontend.util :as util]
|
||||
[frontend.util.entity :as entity]
|
||||
[logseq.common.config :as common-config]
|
||||
[logseq.shui.hooks :as hooks]
|
||||
[logseq.shui.ui :as shui]
|
||||
[medley.core :as medley]
|
||||
@@ -170,7 +171,7 @@
|
||||
(db-async/<get-block repo db-id {:children? false
|
||||
:block-metadata? true}))
|
||||
contents-page (when (= :contents (keyword block-type))
|
||||
(db-async/<get-block repo "Contents" {:children? false}))]
|
||||
(db-async/<get-block repo common-config/contents-page-name {:children? false}))]
|
||||
(build-sidebar-item repo idx db-id block-type *db-id init-key entity contents-page))
|
||||
(p/catch (fn [error]
|
||||
(js/console.error error)))))
|
||||
|
||||
Reference in New Issue
Block a user