diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 8d0cbcf58..6d29a8bb9 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -2369,8 +2369,9 @@ (defn- on-arrow-move-to-boundray [state input e direction] - (when (or (and (= :left direction) (util/input-start? input)) - (and (= :right direction) (util/input-end? input))) + (when (and (not (util/input-selected? input)) + (or (and (= :left direction) (util/input-start? input)) + (and (= :right direction) (util/input-end? input)))) (move-to-block-when-cross-boundrary state e direction))) (defn keydown-arrow-handler diff --git a/src/main/frontend/util.cljc b/src/main/frontend/util.cljc index b5c8ad734..ed0fbf029 100644 --- a/src/main/frontend/util.cljc +++ b/src/main/frontend/util.cljc @@ -765,6 +765,12 @@ (= (count (.-value input)) (.-selectionStart input))))) +#?(:cljs + (defn input-selected? + [input] + (not= (.-selectionStart input) + (.-selectionEnd input)))) + #?(:cljs (defn get-selected-text []