mirror of https://github.com/logseq/logseq
Merge branch 'master' into feature/publishing
commit
f145761278
|
@ -8,7 +8,7 @@
|
|||
;; :sha "7c2822565d9a114c7d8604c335af89de4640e2e5"}
|
||||
datascript-transit {:mvn/version "0.3.0"
|
||||
:exclusions [datascript]}
|
||||
datascript {:mvn/version "0.18.13"}
|
||||
datascript {:mvn/version "1.0.1"}
|
||||
funcool/promesa {:mvn/version "4.0.2"}
|
||||
medley {:mvn/version "1.2.0"}
|
||||
metosin/reitit-frontend {:mvn/version "0.3.10"}
|
||||
|
|
|
@ -2161,50 +2161,6 @@
|
|||
;; TODO: need more thoughts
|
||||
0))
|
||||
|
||||
(defn recompute-block-children
|
||||
[repo block blocks]
|
||||
(if (> (count blocks) 1)
|
||||
(when-let [conn (get-conn repo)]
|
||||
(let [top-parent (:block/uuid (get-block-parent repo (:block/uuid block)))
|
||||
level (:block/level block)
|
||||
result (loop [result []
|
||||
blocks (reverse blocks)
|
||||
last-level 1000
|
||||
children []]
|
||||
(if-let [h (first blocks)]
|
||||
(let [id (:block/uuid h)
|
||||
level (:block/level h)
|
||||
[children current-block-children]
|
||||
(cond
|
||||
(>= level last-level)
|
||||
[(conj children [id level])
|
||||
#{}]
|
||||
|
||||
(< level last-level)
|
||||
(let [current-block-children (set (->> (filter #(< level (second %)) children)
|
||||
(map first)))
|
||||
others (vec (remove #(< level (second %)) children))]
|
||||
[(conj others [id level])
|
||||
current-block-children]))
|
||||
h (assoc h :block/children current-block-children)]
|
||||
(recur (conj result h)
|
||||
(rest blocks)
|
||||
level
|
||||
children))
|
||||
(reverse result)))
|
||||
result (vec result)]
|
||||
(if top-parent
|
||||
(let [top-parent-children (filter (fn [h] (= (:block/level h) level)) blocks)
|
||||
top-parent-children-ids (map :block/uuid top-parent-children)]
|
||||
(if (= 1 (count top-parent-children)) ; no children count changed
|
||||
result
|
||||
(let [old-top-parent-children (:block/children (entity repo [:block/uuid top-parent]))
|
||||
new-children (set/union (set old-top-parent-children) (set top-parent-children-ids))]
|
||||
(conj result {:block/uuid top-parent
|
||||
:block/children new-children}))))
|
||||
result)))
|
||||
blocks))
|
||||
|
||||
(defn get-blocks-by-priority
|
||||
[repo priority]
|
||||
(let [priority (string/capitalize priority)]
|
||||
|
|
|
@ -123,10 +123,6 @@
|
|||
(state/set-edit-content! edit-id new-value)
|
||||
(util/move-cursor-to input (+ cur-pos forward-pos)))))
|
||||
|
||||
(defn copy-block-ref!
|
||||
[block-id]
|
||||
(util/copy-to-clipboard! (str block-id)))
|
||||
|
||||
(defn focus-on-block!
|
||||
[block-id]
|
||||
(when block-id
|
||||
|
@ -478,7 +474,6 @@
|
|||
;; :new-end-pos new-end-pos
|
||||
;; :new-content new-content})
|
||||
retract-refs (compute-retract-refs (:db/id e) (first blocks) ref-pages ref-blocks)
|
||||
blocks (db/recompute-block-children repo block blocks)
|
||||
page-id (:db/id page)
|
||||
modified-time (let [modified-at (tc/to-long (t/now))]
|
||||
[[:db/add page-id :page/last-modified-at modified-at]
|
||||
|
@ -573,7 +568,6 @@
|
|||
value (rebuild-block-content value format)
|
||||
[new-content value] (new-file-content block file-content value)
|
||||
{:keys [blocks pages start-pos end-pos]} (block/parse-block (assoc block :block/content value) format)
|
||||
blocks (db/recompute-block-children repo block blocks)
|
||||
after-blocks (rebuild-after-blocks repo file (:end-pos meta) end-pos)
|
||||
transact-fn (fn []
|
||||
(repo-handler/transact-react-and-alter-file!
|
||||
|
@ -938,6 +932,11 @@
|
|||
{:custom-properties properties'
|
||||
:rebuild-content? false})))))))
|
||||
|
||||
(defn copy-block-ref!
|
||||
[block-id]
|
||||
(set-block-property! block-id "custom_id" (str block-id))
|
||||
(util/copy-to-clipboard! (str block-id)))
|
||||
|
||||
(defn clear-selection!
|
||||
[_e]
|
||||
(when (state/in-selection-mode?)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
(ns frontend.version)
|
||||
|
||||
(defonce version "0.0.3.5-2")
|
||||
(defonce version "0.0.3.5-4")
|
||||
|
|
Loading…
Reference in New Issue