fix: namespace whiteboard pages import

pull/10016/head
Tienson Qin 2023-06-27 00:17:22 +08:00
parent d647cd7107
commit 70406332dc
4 changed files with 16 additions and 12 deletions

View File

@ -294,9 +294,10 @@
{:block/name page-name
:block/original-name original-page-name}
(when with-id?
(let [new-uuid (cond page-entity (:block/uuid page-entity)
(uuid? with-id?) with-id?
:else (d/squuid))]
(let [new-uuid (or
(cond page-entity (:block/uuid page-entity)
(uuid? with-id?) with-id?)
(d/squuid))]
{:block/uuid new-uuid}))
(when namespace?
(let [namespace (first (gp-util/split-last "/" original-page-name))]

View File

@ -116,13 +116,15 @@
(defn split-namespace-pages
[title]
(let [parts (string/split title "/")]
(->>
(loop [others (rest parts)
result [(first parts)]]
(if (seq others)
(let [prev (last result)]
(recur (rest others)
(conj result (str prev "/" (first others)))))
result))))
result))
(map string/trim))))
(defn decode-namespace-underlines
"Decode namespace underlines to slashed;

View File

@ -122,7 +122,8 @@
:properties - map
"
[{: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)
whiteboard? (= type "whiteboard")]
(try (page-handler/create! title {:redirect? false