fix: virtualized blocks selection

This commit is contained in:
Tienson Qin
2024-07-25 23:12:24 +08:00
parent dd73e4c21e
commit eb1108527c
2 changed files with 5 additions and 7 deletions

View File

@@ -1244,16 +1244,15 @@
latest-block-id (when latest-visible-block (.-id latest-visible-block))]
(if (and visible? (util/el-visible-in-viewport? end-block-node))
(let [blocks (util/get-nodes-between-two-nodes start-block end-block-id "ls-block")
direction (util/get-direction-between-two-nodes start-block end-block-id "ls-block")]
direction (util/get-direction-between-two-nodes start-block end-block-id "ls-block")
blocks (if (= direction :up) (reverse blocks) blocks)]
(state/exit-editing-and-set-selected-blocks! blocks direction))
(when latest-visible-block
(let [blocks (util/get-nodes-between-two-nodes latest-block-id end-block-id "ls-block")
direction (if (= latest-block-id end-block-id)
select-direction
(util/get-direction-between-two-nodes latest-block-id end-block-id "ls-block"))
blocks (if (= direction :up)
(reverse (util/sort-by-height blocks))
(util/sort-by-height blocks))]
blocks (if (= direction :up) (reverse (util/sort-by-height blocks)) (util/sort-by-height blocks))]
(if append?
(do (state/clear-edit!)
(if (and select-direction (not= direction select-direction))