mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 18:36:43 +00:00
fix: switch to use :map type for pdf hl-value
This commit is contained in:
@@ -111,38 +111,29 @@
|
||||
(let [text (:text content)
|
||||
wrap-props #(if-let [stamp (:image content)]
|
||||
(assoc %
|
||||
(pu/get-pid :logseq.property/hl-type) :area
|
||||
(pu/get-pid :logseq.property.pdf/hl-stamp) stamp)
|
||||
(pu/get-pid :logseq.property/hl-type) :area
|
||||
(pu/get-pid :logseq.property.pdf/hl-stamp) stamp)
|
||||
%)
|
||||
props (cond->
|
||||
{(pu/get-pid :logseq.property/ls-type) :annotation
|
||||
(pu/get-pid :logseq.property.pdf/hl-page) page
|
||||
(pu/get-pid :logseq.property/hl-color) (:color properties)
|
||||
(pu/get-pid :logseq.property.pdf/hl-value) (pr-str hl)}
|
||||
{(pu/get-pid :logseq.property/ls-type) :annotation
|
||||
(pu/get-pid :logseq.property.pdf/hl-page) page
|
||||
(pu/get-pid :logseq.property/hl-color) (:color properties)
|
||||
(pu/get-pid :logseq.property.pdf/hl-value) hl}
|
||||
(not (config/db-based-graph? (state/get-current-repo)))
|
||||
;; force custom uuid
|
||||
(assoc :id (if (string? id) (uuid id) id)))
|
||||
properties (wrap-props props)]
|
||||
(when (string? text)
|
||||
(editor-handler/api-insert-new-block!
|
||||
text (merge {:page (:block/name ref-page)
|
||||
:custom-uuid id
|
||||
:properties properties}
|
||||
insert-opts))))))))))
|
||||
text (merge {:page (:block/name ref-page)
|
||||
:custom-uuid id
|
||||
:properties properties}
|
||||
insert-opts))))))))))
|
||||
|
||||
(defn construct-highlights-from-hls-page
|
||||
[hls-page]
|
||||
(p/let [blocks (db-async/<get-page-all-blocks (:block/name hls-page))]
|
||||
(let [hls (volatile! [])
|
||||
blocks (->> (for [block blocks]
|
||||
(do (when-let [hl-value (:logseq.property.pdf/hl-value block)]
|
||||
(vswap! hls conj hl-value))
|
||||
(when (:logseq.property/created-from-property block)
|
||||
[(:db/id block) block]))) (into {}))
|
||||
hls (some->> @hls (map #(when-let [id (:db/id %)]
|
||||
(some-> (get blocks id) :block/title (common-handler/safe-read-string nil))))
|
||||
(remove nil?))]
|
||||
{:highlights hls})))
|
||||
(p/let [blocks (db-async/<get-page-all-blocks (:block/uuid hls-page))]
|
||||
{:highlights (keep :logseq.property.pdf/hl-value blocks)}))
|
||||
|
||||
(defn load-hls-data$
|
||||
[{:keys [hls-file]}]
|
||||
|
||||
Reference in New Issue
Block a user