Переглянути джерело

fix: import of unlinked pdf annotations

This addresses the importer failing for
https://github.com/logseq/db-test/issues/732
Gabriel Horner 1 тиждень тому
батько
коміт
23d6f1538a

+ 6 - 0
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 {}))]

+ 1 - 1
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]

+ 6 - 0
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