From ea9d850412fb7325d4ee742165742a507c093cdf Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Fri, 24 May 2024 10:00:43 +0200 Subject: [PATCH] Fix selectionStart not being detectable (selectionStart doesnt work for number) --- .../src/app/main/ui/workspace/tokens/editable_select.cljs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs b/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs index 78d984661..6c487cbd3 100644 --- a/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/editable_select.cljs @@ -149,7 +149,7 @@ token (let [backspace? (kbd/backspace? event) enter? (kbd/enter? event) value (-> event dom/get-target dom/get-value) - caret-at-beginning? (nil? (.. event -target -selectionStart)) + caret-at-beginning? (zero? (.. event -target -selectionStart)) no-text-selected? (str/empty? (.toString (js/document.getSelection))) delete-token? (and backspace? caret-at-beginning? no-text-selected?) replace-token-with-value? (and enter? (seq (str/trim value)))] @@ -223,8 +223,7 @@ :on-change handle-token-change-input :on-key-down handle-key-down :on-focus handle-focus - :on-blur handle-blur - :type type}] + :on-blur handle-blur}] (= type "number") [:> numeric-input* {:autoFocus refocus? :value (or current-value "") :className input-class