diff --git a/deps/graph-parser/src/logseq/graph_parser/config.cljs b/deps/graph-parser/src/logseq/graph_parser/config.cljs index 1626edc001..813ef13704 100644 --- a/deps/graph-parser/src/logseq/graph_parser/config.cljs +++ b/deps/graph-parser/src/logseq/graph_parser/config.cljs @@ -24,7 +24,8 @@ (defn whiteboard? [path] - (and (string/includes? path (str "/" default-whiteboards-directory "/")) + (and path + (string/includes? path (str default-whiteboards-directory "/")) (string/ends-with? path ".edn"))) ;; TODO: rename diff --git a/deps/graph-parser/src/logseq/graph_parser/extract.cljc b/deps/graph-parser/src/logseq/graph_parser/extract.cljc index 08938a23e7..1b4b16c68c 100644 --- a/deps/graph-parser/src/logseq/graph_parser/extract.cljc +++ b/deps/graph-parser/src/logseq/graph_parser/extract.cljc @@ -186,17 +186,17 @@ [file content {:keys [verbose] :or {verbose true} :as options}] (let [_ (when verbose (println "Parsing start: " file)) {:keys [pages blocks]} (gp-util/safe-read-string content) - page-block (first pages)] - (when (:block/whiteboard? page-block) - (let [page-name (filepath->page-name file) - page-entity (build-page-entity {} file page-name page-name nil options) - page-block (merge page-block page-entity {:block/uuid (d/squuid)}) - blocks (->> blocks - (map #(merge % {:block/level 1 - :block/uuid (gp-block/get-custom-id-or-new-id (:block/properties %))})) - (gp-block/with-parent-and-left {:block/name page-name}))] - {:pages [page-block] - :blocks blocks})))) + page-block (first pages) + page-name (filepath->page-name file) + page-entity (build-page-entity {} file page-name page-name nil options) + page-block (merge page-block page-entity {:block/uuid (d/squuid)}) + blocks (->> blocks + (map #(merge % {:block/level 1 + :block/uuid (gp-block/get-custom-id-or-new-id (:block/properties %))})) + (gp-block/with-parent-and-left {:block/name page-name})) + _ (when verbose (println "Parsing finished: " file))] + {:pages [page-block] + :blocks blocks})) (defn- with-block-uuid [pages] diff --git a/src/main/frontend/modules/outliner/file.cljs b/src/main/frontend/modules/outliner/file.cljs index 8c303fee31..78f917b42a 100644 --- a/src/main/frontend/modules/outliner/file.cljs +++ b/src/main/frontend/modules/outliner/file.cljs @@ -32,7 +32,7 @@ [repo page-db-id] (let [page-block (db/pull repo '[* {:block/file [:file/path]}] page-db-id) file-path (get-in page-block [:block/file :file/path]) - edn? (string/ends-with? file-path ".edn") + edn? (and file-path (string/ends-with? file-path ".edn")) blocks (model/get-page-blocks-no-cache repo (:block/name page-block) {:pull-keys (if edn? blocks-pull-keys-with-persisted-ids '[*])})] (when-not (and (= 1 (count blocks)) diff --git a/src/main/frontend/modules/whiteboard/core.cljs b/src/main/frontend/modules/whiteboard/core.cljs index d9e7572751..2af58b557e 100644 --- a/src/main/frontend/modules/whiteboard/core.cljs +++ b/src/main/frontend/modules/whiteboard/core.cljs @@ -1,6 +1,7 @@ (ns frontend.modules.whiteboard.core (:require [frontend.db :as db] [frontend.db.model :as model] + [clojure.pprint :as pprint] [goog.object :as gobj])) (defn- get-page-block [page-name] @@ -8,7 +9,8 @@ (defn- block->shape [block] (let [properties (:block/properties block)] - (merge properties + (merge block + properties ;; Use the block's id as the shape's id. {:id (str (:block/uuid block))}))) @@ -47,3 +49,5 @@ blocks {}) blocks (map #(shape->block blocks-by-uuid %) shapes)] [page-block blocks])) + +(js/console.log (page-name->tldr "edn-test")) \ No newline at end of file