Merge branch 'feat/db' into refactor/narrow-gap-between-page-and-block

This commit is contained in:
Tienson Qin
2024-07-21 11:34:49 +08:00
57 changed files with 3654 additions and 354 deletions

View File

@@ -3244,10 +3244,17 @@
(some-> (first (dom/by-class "reveal"))
(dom/has-class? "focused")))
(defn- in-page-preview?
[]
(some-> js/document.activeElement
(.closest ".ls-preview-popup")
(nil?) (not)))
(defn shortcut-up-down [direction]
(fn [e]
(when (and (not (auto-complete?))
(not (in-shui-popup?))
(or (in-page-preview?)
(not (in-shui-popup?)))
(not (slide-focused?))
(not (state/get-timestamp-block)))
(util/stop e)
@@ -3287,17 +3294,14 @@
(defn open-selected-block!
[direction e]
(let [selected-blocks (state/get-selection-blocks)
f (case direction
:left first
:right last)]
(when-let [block-id (some-> selected-blocks
f
(dom/attr "blockid")
uuid)]
f (case direction :left first :right last)
node (some-> selected-blocks f)]
(when-let [block-id (some-> node (dom/attr "blockid") uuid)]
(util/stop e)
(let [block {:block/uuid block-id}
left? (= direction :left)]
(edit-block! block (if left? 0 :max))))))
(let [block {:block/uuid block-id}
left? (= direction :left)
opts {:container-id (some-> node (dom/attr "containerid") (parse-long))}]
(edit-block! block (if left? 0 :max) opts)))))
(defn shortcut-left-right [direction]
(fn [e]