mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 09:26:28 +00:00
Merge remote-tracking branch 'upstream/master' into whiteboards
This commit is contained in:
@@ -2451,7 +2451,10 @@
|
||||
(state/exit-editing-and-set-selected-blocks! [block]))))
|
||||
|
||||
(defn- select-up-down [direction]
|
||||
(let [selected (first (state/get-selection-blocks))
|
||||
(let [selected-blocks (state/get-selection-blocks)
|
||||
selected (case direction
|
||||
:up (first selected-blocks)
|
||||
:down (last selected-blocks))
|
||||
f (case direction
|
||||
:up util/get-prev-block-non-collapsed
|
||||
:down util/get-next-block-non-collapsed)
|
||||
@@ -3079,7 +3082,7 @@
|
||||
(state/editing?)
|
||||
(keydown-up-down-handler direction)
|
||||
|
||||
(and (state/selection?) (== 1 (count (state/get-selection-blocks))))
|
||||
(state/selection?)
|
||||
(select-up-down direction)
|
||||
|
||||
:else
|
||||
@@ -3108,34 +3111,35 @@
|
||||
|
||||
(defn open-selected-block!
|
||||
[direction e]
|
||||
(when-let [block-id (some-> (state/get-selection-blocks)
|
||||
first
|
||||
(dom/attr "blockid")
|
||||
uuid)]
|
||||
(util/stop e)
|
||||
(let [block {:block/uuid block-id}
|
||||
block-id (-> (state/get-selection-blocks)
|
||||
first
|
||||
(gobj/get "id")
|
||||
(string/replace "ls-block" "edit-block"))
|
||||
left? (= direction :left)]
|
||||
(edit-block! block
|
||||
(if left? 0 :max)
|
||||
block-id))))
|
||||
(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)]
|
||||
(util/stop e)
|
||||
(let [block {:block/uuid block-id}
|
||||
block-id (-> selected-blocks
|
||||
f
|
||||
(gobj/get "id")
|
||||
(string/replace "ls-block" "edit-block"))
|
||||
left? (= direction :left)]
|
||||
(edit-block! block
|
||||
(if left? 0 :max)
|
||||
block-id)))))
|
||||
|
||||
(defn shortcut-left-right [direction]
|
||||
(fn [e]
|
||||
(when-not (auto-complete?)
|
||||
(util/stop e)
|
||||
(cond
|
||||
(state/editing?)
|
||||
(do
|
||||
(util/stop e)
|
||||
(keydown-arrow-handler direction))
|
||||
(keydown-arrow-handler direction)
|
||||
|
||||
(and (state/selection?) (== 1 (count (state/get-selection-blocks))))
|
||||
(do
|
||||
(util/stop e)
|
||||
(open-selected-block! direction e))
|
||||
(state/selection?)
|
||||
(open-selected-block! direction e)
|
||||
|
||||
:else
|
||||
nil))))
|
||||
|
||||
Reference in New Issue
Block a user