fix: pdf related properties for db graphs

Added to new property ns as file and file-path are too generic to be top-level.
Also fixed bugs in page creation
This commit is contained in:
Gabriel Horner
2024-05-09 13:35:44 -04:00
parent 123cb8fc42
commit 70d92c8f7a
3 changed files with 35 additions and 28 deletions

View File

@@ -168,21 +168,22 @@
(page-handler/<create! page-name {:redirect? false :create-first-block? false
:split-namespace? false
:format format
;; FIXME: file and file-path properties for db version
:properties {:file (case format
:markdown
(util/format "[%s](%s)" label url)
:properties {(pu/get-pid :logseq.property.pdf/file)
(case format
:markdown
(util/format "[%s](%s)" label url)
:org
(util/format "[[%s][%s]]" url label)
:org
(util/format "[[%s][%s]]" url label)
url)
:file-path url}})
url)
(pu/get-pid :logseq.property.pdf/file-path)
url}})
(db-model/get-page page-name)))
;; try to update file path
(do
(property-handler/add-page-property! page-name (pu/get-pid :logseq.property/file-path) url)
(property-handler/add-page-property! page-name (pu/get-pid :logseq.property.pdf/file-path) url)
page)))))
(defn ensure-ref-block!
@@ -236,8 +237,7 @@
(let [id (:block/uuid block)
page (db-utils/pull (:db/id (:block/page block)))
page-name (:block/original-name page)
;; FIXME: file-path property for db version
file-path (:file-path (:block/properties page))
file-path (pu/get-block-property-value block :logseq.property.pdf/file-path)
hl-page (pu/get-block-property-value block :logseq.property/hl-page)]
(when-let [target-key (and page-name (subs page-name 5))]
(p/let [hls (resolve-hls-data-by-key$ target-key)