fix: bulk indent && outdent

This commit is contained in:
Tienson Qin
2021-04-10 10:08:54 +08:00
parent 2aadcc671f
commit a9007ec134
2 changed files with 14 additions and 2 deletions

View File

@@ -20,6 +20,10 @@
(assert (map? m) (util/format "block data must be map,got: %s %s" (type m) m))
(->Block m))
(defn get-data
[block]
(:data block))
(defn get-block-by-id
[id]
(let [c (conn/get-conn false)
@@ -293,7 +297,7 @@
(some-> last-node-right
(tree/-set-left-id first-node-left-id)
(tree/-save txs-state))
(outliner-file/sync-to-file first-node)))
(outliner-file/sync-to-file (get-data first-node))))
(when-not (first-level? first-node)
(let [parent (tree/-get-parent first-node)
parent-parent-id (tree/-get-parent-id parent)

View File

@@ -1,10 +1,18 @@
(ns frontend.modules.outliner.file
(:require [frontend.db.model :as model]
[frontend.db :as db]
[frontend.modules.outliner.tree :as tree]
[frontend.modules.file.core :as file]))
(defn sync-to-file
[{page-db-id :db/id :as page-block}]
(let [blocks (model/get-blocks-by-page page-db-id)
(let [page-block (if (:block/name page-block)
(db/pull page-db-id)
(some-> (db/entity page-db-id)
:block/page
:db/id
db/pull))
page-db-id (:db/id page-block)
blocks (model/get-blocks-by-page page-db-id)
tree (tree/blocks->vec-tree blocks (:block/name page-block))]
(file/save-tree page-block tree)))