Merge branch 'feat/outliner-core' of github.com:logseq/logseq into feat/outliner-core

pull/1672/head
Tienson Qin 2021-04-16 00:03:25 +08:00
commit a884c84f20
3 changed files with 18 additions and 2 deletions

View File

@ -2363,6 +2363,7 @@
[e]
(cut-blocks-and-clear-selections! false))
;; credits to @pengx17
(defn- copy-current-block-ref
[]
(when-let [current-block (state/get-edit-block)]

View File

@ -380,8 +380,7 @@
(tree/-save txs-state)))
(some-> last-node-right
(tree/-set-left-id first-node-left-id)
(tree/-save txs-state))
(outliner-file/sync-to-file (get-data first-node))))
(tree/-save txs-state))))
(when-not (first-level? first-node)
(let [parent (tree/-get-parent first-node)
parent-parent-id (tree/-get-parent-id parent)

View File

@ -32,3 +32,19 @@
(async/put! write-chan page-db-id))
(util/batch write-chan batch-write-interval write-files!)
(defn batch [in max-time handler]
(async/go-loop [buf [] t (async/timeout max-time)]
(let [[v p] (async/alts! [in t])]
(cond
(= p t)
(do
(handler buf)
(recur [] (async/timeout max-time)))
(nil? v) ; stop
(when (seq buf)
(handler buf))
:else
(recur (conj buf v) t)))))