fix: jump to the wrong position when there're selected blocks

This commit is contained in:
Tienson Qin
2024-06-03 14:21:07 +08:00
parent 2abe37c987
commit b9b2c0fb88
2 changed files with 14 additions and 6 deletions

View File

@@ -910,7 +910,6 @@
[state route-match main-content]
(let [{:keys [open-fn]} state
current-repo (state/sub :git/current-repo)
selection-mode? (state/sub :selection/mode)
granted? (state/sub [:nfs/user-granted? (state/get-current-repo)])
theme (state/sub :ui/theme)
accent-color (some-> (state/sub :ui/radix-color) (name))
@@ -972,8 +971,11 @@
(when (= "Enter" (.-key e))
(ui/focus-element (ui/main-node))))}
(t :accessibility/skip-to-main-content)]
[:div.#app-container (cond-> {} selection-mode?
(assoc :class "blocks-selection-mode"))
[:div.#app-container {:on-pointer-up (fn []
(when-let [container (gdom/getElement "app-container")]
(d/remove-class! container "blocks-selection-mode")
(when (> (count (state/get-selection-blocks)) 1)
(util/clear-selection!))))}
[:div#left-container
{:class (if (state/sub :ui/sidebar-open?) "overflow-hidden" "w-full")}
(header/header {:open-fn open-fn