Fix zotero highlighting block error after importing from file

This commit is contained in:
Mega Yu
2026-01-08 10:45:01 +08:00
parent 1162f33c77
commit 9409f5a39c
4 changed files with 37 additions and 12 deletions

View File

@@ -198,12 +198,24 @@
(ref/->block-ref (:block/uuid ref-block))
:owner-window (pdf-windows/resolve-own-window viewer)))))
(defn- get-zotero-local-pdf-path
[{:keys [zotero-linked-file zotero-imported-file]}]
(let [zotero-config (get-in (state/sub-config) [:zotero/settings-v2 "default"])
zotero-data-directory (:zotero-data-directory zotero-config)
zotero-linked-attachment-base-directory (:zotero-linked-attachment-base-directory zotero-config)]
(if zotero-linked-file
(str zotero-linked-attachment-base-directory "/" zotero-linked-file)
(str zotero-data-directory "/storage/" zotero-imported-file))))
(defn db-based-open-block-ref!
[block]
(let [hl-value (:logseq.property.pdf/hl-value block)
asset (:logseq.property/asset block)
external-url (:logseq.property.asset/external-url asset)
file-path (or external-url (str "../assets/" (:block/uuid asset) ".pdf"))]
file-path (or external-url (str "../assets/" (:block/uuid asset) ".pdf"))
file-path (if (string/starts-with? file-path "zotero://")
(get-zotero-local-pdf-path (:logseq.property.asset/external-props asset))
file-path)]
(if asset
(->
(p/let [href (assets-handler/<make-asset-url file-path)]

View File

@@ -186,7 +186,8 @@
["65.17" {:properties [:logseq.property.publish/published-url]}]
["65.18" {:fix deprecated-ensure-graph-uuid}]
["65.19" {:properties [:logseq.property/choice-classes :logseq.property/choice-exclusions]}]
["65.20" {:properties [:logseq.property.class/bidirectional-property-title :logseq.property.class/enable-bidirectional?]}]])
["65.20" {:properties [:logseq.property.class/bidirectional-property-title :logseq.property.class/enable-bidirectional?]}]
["65.21" {:properties [:logseq.property.asset/external-props]}]])
(let [[major minor] (last (sort (map (comp (juxt :major :minor) db-schema/parse-schema-version first)
schema-version->updates)))]