Finish migration block ns to nbb

This commit is contained in:
Gabriel Horner
2022-05-12 16:58:26 -04:00
parent 2c725ca5af
commit b1e226745d
15 changed files with 215 additions and 172 deletions

View File

@@ -266,7 +266,7 @@
(if (and (:block/pre-block? block)
(seq (:block/properties block)))
(let [page-properties (:block/properties block)
str->page (fn [n] (gp-block/page-name->map n true))
str->page (fn [n] (block/page-name->map n true))
refs (->> page-properties
(filter (fn [[_ v]] (coll? v)))
(vals)
@@ -670,7 +670,9 @@
(defn properties-block
[properties format page]
(let [content (property/insert-properties format "" properties)
refs (gp-block/get-page-refs-from-properties properties)]
refs (gp-block/get-page-refs-from-properties properties
(db/get-db (state/get-current-repo))
(state/get-date-formatter))]
{:block/pre-block? true
:block/uuid (db/new-block-id)
:block/properties properties
@@ -1946,7 +1948,7 @@
content* (str (if (= :markdown format) "- " "* ")
(property/insert-properties format content props))
ast (mldoc/->edn content* (gp-mldoc/default-config format))
blocks (gp-block/extract-blocks ast content* true format)
blocks (block/extract-blocks ast content* true format)
fst-block (first blocks)]
(assert fst-block "fst-block shouldn't be nil")
(assoc fst-block :block/level (:block/level block)))))))
@@ -2853,7 +2855,7 @@
[format text]
(when-let [editing-block (state/get-edit-block)]
(let [page-id (:db/id (:block/page editing-block))
blocks (gp-block/extract-blocks
blocks (block/extract-blocks
(mldoc/->edn text (gp-mldoc/default-config format)) text true format)
blocks' (block/with-parent-and-left page-id blocks)]
(paste-blocks blocks' {}))))