mirror of https://github.com/logseq/logseq
fix: db import of some whiteboard pages
Also fix old whiteboards not having correct :block/type. Part of LOG-3176pull/11433/head
parent
60cd9b00da
commit
62252479ee
|
@ -418,16 +418,8 @@
|
|||
updated properties in :block-properties and any property values tx in :pvalues-tx"
|
||||
[props _db page-names-to-uuids
|
||||
{:block/keys [properties-text-values] :as block}
|
||||
{:keys [_whiteboard? import-state] :as options}]
|
||||
(let [;; FIXME: Whiteboard
|
||||
;; prop-name->uuid (if whiteboard?
|
||||
;; (fn prop-name->uuid [k]
|
||||
;; (or (get-pid db k)
|
||||
;; (throw (ex-info (str "No uuid found for page " (pr-str k))
|
||||
;; {:page k}))))
|
||||
;; (fn prop-name->uuid [k]
|
||||
;; (get-page-uuid page-names-to-uuids k)))
|
||||
{:keys [all-idents property-schemas]} import-state
|
||||
{:keys [import-state] :as options}]
|
||||
(let [{:keys [all-idents property-schemas]} import-state
|
||||
get-ident' #(get-ident @all-idents %)
|
||||
user-properties (apply dissoc props built-in-property-names)]
|
||||
(when (seq user-properties)
|
||||
|
@ -873,7 +865,8 @@
|
|||
{:keys [pages-tx page-properties-tx page-names-to-uuids existing-pages]} (build-pages-tx conn pages blocks tx-options)
|
||||
whiteboard-pages (->> pages-tx
|
||||
;; support old and new whiteboards
|
||||
(filter #(#{"whiteboard" ["whiteboard"]} (:block/type %)))
|
||||
(filter #(or (contains? (set (:block/type %)) "whiteboard")
|
||||
(= "whiteboard" (:block/type %))))
|
||||
(map (fn [page-block]
|
||||
(-> page-block
|
||||
(assoc :block/format :markdown
|
||||
|
|
|
@ -322,9 +322,10 @@
|
|||
page-name)
|
||||
page-block (merge {:block/name page-name
|
||||
:block/original-name original-name
|
||||
:block/type #{"whiteboard" "page"}
|
||||
:block/file {:file/path (common-util/path-normalize file)}}
|
||||
serialized-page)
|
||||
serialized-page
|
||||
;; Ensure old whiteboards have correct type
|
||||
{:block/type #{"whiteboard" "page"}})
|
||||
page-block (gp-whiteboard/migrate-page-block page-block)
|
||||
blocks (->> blocks
|
||||
(map gp-whiteboard/migrate-shape-block)
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
:where [?b :block/original-name] [_ :block/page ?b]] @conn)
|
||||
(filter #(= ["page"] (:block/type %))))))
|
||||
"Correct number of pages with block content")
|
||||
(is (= 3 (count (d/datoms @conn :avet :block/type "whiteboard"))))
|
||||
(is (= 4 (count (d/datoms @conn :avet :block/type "whiteboard"))))
|
||||
(is (= 1 (count @(:ignored-properties import-state))) ":filters should be the only ignored property")
|
||||
(is (= 1 (count @assets))))
|
||||
|
||||
|
|
55
deps/graph-parser/test/resources/exporter-test-graph/whiteboards/ref page.edn
vendored
Normal file
55
deps/graph-parser/test/resources/exporter-test-graph/whiteboards/ref page.edn
vendored
Normal file
|
@ -0,0 +1,55 @@
|
|||
{:blocks (
|
||||
{:block/content "new block [[some page]]"
|
||||
:block/created-at 1720805247589
|
||||
:block/format :markdown
|
||||
:block/parent
|
||||
{:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
|
||||
:block/properties
|
||||
{}
|
||||
:block/updated-at 1720805270629
|
||||
:block/uuid #uuid "6691677f-c208-4c83-aa40-6efc4286100c"}
|
||||
{:block/properties
|
||||
{:ls-type :whiteboard-shape
|
||||
:logseq.tldraw.shape
|
||||
{:blockType "B"
|
||||
:stroke ""
|
||||
:collapsed false
|
||||
:borderRadius 8
|
||||
:scale [1 1]
|
||||
:pageId "6691677f-c208-4c83-aa40-6efc4286100c"
|
||||
:scaleLevel "md"
|
||||
:fill ""
|
||||
:compact true
|
||||
:isAutoResizing true
|
||||
:type "logseq-portal"
|
||||
:size [400 124.9781494140625]
|
||||
:strokeType "line"
|
||||
:strokeWidth 2
|
||||
:opacity 1
|
||||
:id "01b33340-4074-11ef-956e-7d9aebf284ae"
|
||||
:noFill false
|
||||
:point [430.41563108563423 233.00156784057617]
|
||||
:parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
|
||||
:collapsedHeight 0
|
||||
:nonce 1720805246071
|
||||
:pageName nil}}
|
||||
:block/updated-at 1720805262144
|
||||
:block/created-at 1720805262144})
|
||||
:pages (
|
||||
{:block/tx-id 536871836
|
||||
:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"
|
||||
:block/properties
|
||||
{:ls-type :whiteboard-page
|
||||
:logseq.tldraw.page
|
||||
{:id "6691676f-2eed-4619-b56a-69fd7d572c59"
|
||||
:name "ref page"
|
||||
:bindings
|
||||
{}
|
||||
:nonce 1
|
||||
:assets []}}
|
||||
:block/updated-at 1720805270629
|
||||
:block/created-at 1720805231835
|
||||
:block/format :markdown
|
||||
:block/type ["page" "whiteboard"]
|
||||
:block/name "ref page"
|
||||
:block/original-name "ref page"})}
|
Loading…
Reference in New Issue