From ca7b3a56be51e24ef1dd028eadac43b3cab6af26 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Sun, 2 Mar 2025 13:38:49 +0800 Subject: [PATCH] fix: show action bar for the first visible node --- src/main/frontend/handler/editor.cljs | 2 +- src/main/frontend/handler/events.cljs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 4056e45f9e..0424d5cc49 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2621,7 +2621,7 @@ (keydown-new-line)))))) (defn- select-first-last - "Select first or last block in viewpoint" + "Select first or last block in viewport" [direction] (let [f (case direction :up last :down first) container (if (some-> js/document.activeElement diff --git a/src/main/frontend/handler/events.cljs b/src/main/frontend/handler/events.cljs index 2be871a850..a462127519 100644 --- a/src/main/frontend/handler/events.cljs +++ b/src/main/frontend/handler/events.cljs @@ -1078,7 +1078,7 @@ (defmethod handle :editor/show-action-bar [] (let [selection (state/get-selection-blocks) - first-visible-block (first selection)] + first-visible-block (some #(when (util/el-visible-in-viewport? % true) %) selection)] (when first-visible-block (shui/popup-hide! :selection-action-bar) (shui/popup-show!