chore: remove unused fns

pull/1656/head
Tienson Qin 2021-04-05 14:16:47 +08:00
parent 10f7f078f7
commit f6964065b6
2 changed files with 0 additions and 78 deletions

View File

@ -667,7 +667,6 @@
(let [block (db-utils/entity repo [:block/uuid block-uuid])]
(some-> (react/q repo [:block/block block-uuid]
{:use-cache? use-cache?
:transform-fn #(block-and-children-transform % repo block-uuid)}
'[:find (pull ?c [*])
:in $ ?id %

View File

@ -12,83 +12,6 @@
[frontend.format.block :as block]
[frontend.debug :as debug]))
(defn blocks->vec-tree
"Deprecated: use frontend.modules.outliner.core/blocks->vec-tree instead."
[col]
(let [col (map (fn [h] (cond->
h
(not (:block/dummy? h))
(dissoc h :block/meta))) col)
parent? (fn [item children]
(and (seq children)
(every? #(< (:block/level item) (:block/level %)) children)))
get-all-refs (fn [block]
(let [refs (if-let [refs (seq (:block/refs-with-children block))]
refs
(concat
(:block/refs block)
(:block/tags block)))]
(distinct refs)))]
(loop [col (reverse col)
children (list)]
(if (empty? col)
children
(let [[item & others] col
cur-level (:block/level item)
bottom-level (:block/level (first children))
pre-block? (:block/pre-block? item)
item (assoc item :block/refs-with-children (->> (get-all-refs item)
(remove nil?)))]
(cond
(empty? children)
(recur others (list item))
(<= bottom-level cur-level)
(recur others (conj children item))
pre-block?
(recur others (cons item children))
(> bottom-level cur-level) ; parent
(let [[children other-children] (split-with (fn [h]
(> (:block/level h) cur-level))
children)
refs-with-children (->> (mapcat get-all-refs (cons item children))
(remove nil?)
distinct)
children (cons
(assoc item
:block/children children
:block/refs-with-children refs-with-children)
other-children)]
(recur others children))))))))
;; recursively with children content for tree
(defn get-block-content-rec
([block]
(get-block-content-rec block (fn [block] (:block/content block))))
([block transform-fn]
(let [contents (atom [])
_ (walk/prewalk
(fn [form]
(when (map? form)
(when-let [content (:block/content form)]
(swap! contents conj (transform-fn form))))
form)
block)]
(apply util/join-newline @contents))))
(defn get-block-end-pos-rec
[repo block]
(let [children (:block/children block)]
(if (seq children)
(get-block-end-pos-rec repo (last children))
(if-let [end-pos (get-in block [:block/meta :end-pos])]
end-pos
(when-let [block (db/entity repo [:block/uuid (:block/uuid block)])]
(get-in block [:block/meta :end-pos]))))))
(defn get-block-ids
[block]
(let [ids (atom [])