diff --git a/deps/db/src/logseq/db/sqlite/util.cljs b/deps/db/src/logseq/db/sqlite/util.cljs index 071f1dbbc2..e5f14a1025 100644 --- a/deps/db/src/logseq/db/sqlite/util.cljs +++ b/deps/db/src/logseq/db/sqlite/util.cljs @@ -118,7 +118,7 @@ (cond-> {:block/format :markdown} (not= (:db/ident block) :logseq.class/Tag) - (assoc :block/tags #{:logseq.class/Tag}))) + (assoc :block/tags (set (conj (:block/tags block) :logseq.class/Tag))))) (and (not= (:db/ident block) :logseq.class/Root) (nil? (:logseq.property/parent block))) (assoc :logseq.property/parent :logseq.class/Root)))) diff --git a/deps/graph-parser/src/logseq/graph_parser/exporter.cljs b/deps/graph-parser/src/logseq/graph_parser/exporter.cljs index c7e49735bb..b059655b0d 100644 --- a/deps/graph-parser/src/logseq/graph_parser/exporter.cljs +++ b/deps/graph-parser/src/logseq/graph_parser/exporter.cljs @@ -75,14 +75,16 @@ {:db/ident db-ident} (let [m (if (:block/namespace class-block) - ;; Give namespaced tags a unique ident so they don't conflict with other tags - (-> (db-class/build-new-class db {:block/title (build-class-ident-name class-name)}) + ;; Give namespaced tags a unique ident so they don't conflict with other tags + (-> (db-class/build-new-class db {:block/title (build-class-ident-name class-name) + :block/tags (:block/tags class-block)}) (merge {:block/title class-name :block/name (common-util/page-name-sanity-lc class-name)}) (build-new-namespace-page)) (db-class/build-new-class db - {:block/title class-name - :block/name (common-util/page-name-sanity-lc class-name)}))] + (assoc {:block/title class-name + :block/name (common-util/page-name-sanity-lc class-name)} + :block/tags (:block/tags class-block))))] (swap! all-idents assoc ident (:db/ident m)) (with-meta m {:new-class? true})))))) @@ -704,8 +706,9 @@ (seq classes-from-properties) ;; Add a map of {:block.temp/new-class TAG} to be processed later (update :block/tags - (fnil into []) - (map #(hash-map :block.temp/new-class %) classes-from-properties))) + (fn [tags] + (let [tags' (if (sequential? tags) tags (set tags))] + (into tags' (map #(hash-map :block.temp/new-class %) classes-from-properties)))))) :properties-tx pvalues-tx}) {:block block :properties-tx []}) (update :block dissoc :block/properties :block/properties-text-values :block/properties-order :block/invalid-properties))) diff --git a/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs b/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs index 86a3798af2..4e4279e8f8 100644 --- a/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs +++ b/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs @@ -617,8 +617,8 @@ (is (nil? (find-page-by-name @conn "type")) "No page exists for configured property") - (is (= [:user.class/Property] - (:block/tags (readable-properties @conn (find-page-by-name @conn "url")))) + (is (= #{:user.class/Property :logseq.class/Page} + (set (:block/tags (readable-properties @conn (find-page-by-name @conn "url"))))) "tagged page has configured tag imported as a class")))) (deftest-async export-files-with-remove-inline-tags