refactor: extract out cursor pos function

This commit is contained in:
Weihua Lu
2021-06-09 12:17:30 +08:00
committed by Tienson Qin
parent 9b3f756c6a
commit 3cbf3b74be
5 changed files with 32 additions and 37 deletions

View File

@@ -34,6 +34,10 @@
:left js/Number.MAX_SAFE_INTEGER
:top js/Number.MAX_SAFE_INTEGER}))))
(defn pos [input]
(when input
(.-selectionStart input)))
(defn move-cursor-to [input n]
(.setSelectionRange input n n))