mirror of https://github.com/logseq/logseq
fix: namespace whiteboard pages import
parent
d647cd7107
commit
70406332dc
|
@ -294,9 +294,10 @@
|
||||||
{:block/name page-name
|
{:block/name page-name
|
||||||
:block/original-name original-page-name}
|
:block/original-name original-page-name}
|
||||||
(when with-id?
|
(when with-id?
|
||||||
(let [new-uuid (cond page-entity (:block/uuid page-entity)
|
(let [new-uuid (or
|
||||||
(uuid? with-id?) with-id?
|
(cond page-entity (:block/uuid page-entity)
|
||||||
:else (d/squuid))]
|
(uuid? with-id?) with-id?)
|
||||||
|
(d/squuid))]
|
||||||
{:block/uuid new-uuid}))
|
{:block/uuid new-uuid}))
|
||||||
(when namespace?
|
(when namespace?
|
||||||
(let [namespace (first (gp-util/split-last "/" original-page-name))]
|
(let [namespace (first (gp-util/split-last "/" original-page-name))]
|
||||||
|
|
|
@ -116,13 +116,15 @@
|
||||||
(defn split-namespace-pages
|
(defn split-namespace-pages
|
||||||
[title]
|
[title]
|
||||||
(let [parts (string/split title "/")]
|
(let [parts (string/split title "/")]
|
||||||
(loop [others (rest parts)
|
(->>
|
||||||
result [(first parts)]]
|
(loop [others (rest parts)
|
||||||
(if (seq others)
|
result [(first parts)]]
|
||||||
(let [prev (last result)]
|
(if (seq others)
|
||||||
(recur (rest others)
|
(let [prev (last result)]
|
||||||
(conj result (str prev "/" (first others)))))
|
(recur (rest others)
|
||||||
result))))
|
(conj result (str prev "/" (first others)))))
|
||||||
|
result))
|
||||||
|
(map string/trim))))
|
||||||
|
|
||||||
(defn decode-namespace-underlines
|
(defn decode-namespace-underlines
|
||||||
"Decode namespace underlines to slashed;
|
"Decode namespace underlines to slashed;
|
||||||
|
|
|
@ -122,7 +122,8 @@
|
||||||
:properties - map
|
:properties - map
|
||||||
"
|
"
|
||||||
[{:keys [type uuid title children properties] :as tree}]
|
[{:keys [type uuid title children properties] :as tree}]
|
||||||
(let [has-children? (seq children)
|
(let [title (string/trim title)
|
||||||
|
has-children? (seq children)
|
||||||
page-format (or (some-> tree (:children) (first) (:format)) :markdown)
|
page-format (or (some-> tree (:children) (first) (:format)) :markdown)
|
||||||
whiteboard? (= type "whiteboard")]
|
whiteboard? (= type "whiteboard")]
|
||||||
(try (page-handler/create! title {:redirect? false
|
(try (page-handler/create! title {:redirect? false
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
;; only apply uuid to the deepest hierarchy of page to create if provided.
|
;; only apply uuid to the deepest hierarchy of page to create if provided.
|
||||||
(-> (block/page-name->map page (if (= page title) with-uuid? true))
|
(-> (block/page-name->map page (if (= page title) with-uuid? true))
|
||||||
(assoc :block/format format)))
|
(assoc :block/format format)))
|
||||||
pages)
|
pages)
|
||||||
txs (->> pages
|
txs (->> pages
|
||||||
;; for namespace pages, only last page need properties
|
;; for namespace pages, only last page need properties
|
||||||
drop-last
|
drop-last
|
||||||
|
|
Loading…
Reference in New Issue