From 23d6f1538a514b7385a3b1ac5ef47888f3ee585a Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Mon, 26 Jan 2026 12:05:44 -0500 Subject: [PATCH] fix: import of unlinked pdf annotations This addresses the importer failing for https://github.com/logseq/db-test/issues/732 --- deps/graph-parser/src/logseq/graph_parser/exporter.cljs | 6 ++++++ .../test/logseq/graph_parser/exporter_test.cljs | 2 +- .../exporter-test-graph/pages/unlinked-highlights.md | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 deps/graph-parser/test/resources/exporter-test-graph/pages/unlinked-highlights.md diff --git a/deps/graph-parser/src/logseq/graph_parser/exporter.cljs b/deps/graph-parser/src/logseq/graph_parser/exporter.cljs index 245a8c928e..3a7658941f 100644 --- a/deps/graph-parser/src/logseq/graph_parser/exporter.cljs +++ b/deps/graph-parser/src/logseq/graph_parser/exporter.cljs @@ -563,6 +563,12 @@ (translate-linked-ref-filters prop-value page-names-to-uuids) :ls-type [[:logseq.property/ls-type (keyword prop-value)]] + :hl-color + (let [color-text-idents + (->> (get-in db-property/built-in-properties [:logseq.property.pdf/hl-color :closed-values]) + (map (juxt :value :db-ident)) + (into {}))] + [[:logseq.property.pdf/hl-color (get color-text-idents prop-value)]]) ;; else [[(built-in-property-file-to-db-idents prop) prop-value]])))) (into {}))] 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 8fdcb816d0..6585357646 100644 --- a/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs +++ b/deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs @@ -220,7 +220,7 @@ (is (= 2 (count (d/q '[:find ?b :where [?b :block/tags :logseq.class/Pdf-annotation]] @conn)))) ;; Properties and tags aren't included in this count as they aren't a Page - (is (= 10 + (is (= 11 (->> (d/q '[:find [?b ...] :where [?b :block/title] diff --git a/deps/graph-parser/test/resources/exporter-test-graph/pages/unlinked-highlights.md b/deps/graph-parser/test/resources/exporter-test-graph/pages/unlinked-highlights.md new file mode 100644 index 0000000000..fe5bef1825 --- /dev/null +++ b/deps/graph-parser/test/resources/exporter-test-graph/pages/unlinked-highlights.md @@ -0,0 +1,6 @@ +- This is a highlights page that doesn't start with 'hls__' and isn't linked to a specific asset file +- blarg blarg + ls-type:: annotation + hl-page:: 110 + hl-color:: purple + id:: 654bafc6-f7e8-4633-b6a6-810dc41cc559 \ No newline at end of file