fix(export): replace page-ref-id with its block/title

This commit is contained in:
rcmerci
2024-08-07 18:46:38 +08:00
parent b1e53f49a8
commit ccba2ef34c
2 changed files with 16 additions and 17 deletions

View File

@@ -1,10 +1,11 @@
(ns frontend.worker.export
"Export data"
(:require [logseq.db :as ldb]
[logseq.outliner.tree :as otree]
(:require [datascript.core :as d]
[frontend.db :as db]
[frontend.worker.file.core :as worker-file]
[datascript.core :as d]
[logseq.graph-parser.property :as gp-property]))
[logseq.db :as ldb]
[logseq.graph-parser.property :as gp-property]
[logseq.outliner.tree :as otree]))
(defn block->content
"Converts a block including its children (recursively) to plain-text."
@@ -14,7 +15,7 @@
(if (ldb/page? (d/entity db [:block/uuid root-block-uuid]))
0
1))
blocks (ldb/get-block-and-children db root-block-uuid)
blocks (db/pull-many (keep :db/id (ldb/get-block-and-children db root-block-uuid)))
tree (otree/blocks->vec-tree repo db blocks (str root-block-uuid))]
(worker-file/tree->file-content repo db tree
(assoc tree->file-opts :init-level init-level)