Fase B3+B4: built-in Project/Area tags and Citation class

B3: registers :logseq.class/Project and :logseq.class/Area as
built-in page-like classes (the TODO in class.cljs already asked for
this), so users can tag pages/journals with them out of the box.
Fixed a markdown-mirror test whose "Custom Tag" fixture used to be
titled "Project" and collided with the new built-in class.

B4: adds :logseq.class/Citation plus /target and /context properties,
following the :logseq.class/Comments pattern. Since target is a
:node-typed ref, citation blocks automatically show up in the
existing block/citation reference graph without any changes there.
This commit is contained in:
2026-08-26 19:03:14 +02:00
parent fcf41c7b41
commit b67f7e9f78
4 changed files with 44 additions and 6 deletions

View File

@@ -51,6 +51,12 @@
{:title "Comment"
:properties {:logseq.property.class/hide-from-node true}}
:logseq.class/Citation
{:title "Citation"
:properties {:logseq.property/icon {:type :tabler-icon :id "quote"}}
:schema {:properties [:logseq.property.citation/target :logseq.property.citation/context]
:required-properties [:logseq.property.citation/target]}}
:logseq.class/Query
{:title "Query"
:properties {:logseq.property/icon {:type :tabler-icon :id "search"}}
@@ -101,7 +107,15 @@
{:title "Template"
:schema {:properties [:logseq.property/template-applied-to]}}
;; TODO: Add more classes such as :book, :paper, :movie, :music, :project)
:logseq.class/Project
{:title "Project"
:properties {:logseq.property.class/extends :logseq.class/Page}}
:logseq.class/Area
{:title "Area"
:properties {:logseq.property.class/extends :logseq.class/Page}}
;; TODO: Add more classes such as :book, :paper, :movie, :music)
)))
(def page-children-classes

View File

@@ -7,6 +7,15 @@
(defn- parent-class-id [db]
(:db/id (d/entity db :user.class/Parent)))
(deftest project-and-area-are-built-in-page-classes
(testing "Project and Area are registered as built-in classes that behave like pages"
(is (contains? db-class/built-in-classes :logseq.class/Project))
(is (contains? db-class/built-in-classes :logseq.class/Area))
(is (contains? db-class/page-children-classes :logseq.class/Project))
(is (contains? db-class/page-children-classes :logseq.class/Area))
(is (not (contains? db-class/private-tags :logseq.class/Project)))
(is (not (contains? db-class/private-tags :logseq.class/Area)))))
(deftest get-class-objects-dedupes-inherited-tags-test
(let [conn (db-test/create-conn-with-blocks
{:classes {:Parent {:block/title "Parent"}