fix(editor): back/forward cursor for emoji char

This commit is contained in:
charlie
2022-01-09 21:22:24 +08:00
committed by Andelf
parent 33fbb0aa1b
commit 9c89c6395b
3 changed files with 35 additions and 9 deletions

View File

@@ -70,7 +70,9 @@
([input n]
(when input
(let [{:keys [pos]} (get-caret-pos input)
pos (+ pos n)]
pos (if (= n 1)
(util/safe-inc-current-pos-from-start (.-value input) pos)
(+ pos n))]
(move-cursor-to input pos)))))
(defn move-cursor-backward
@@ -79,7 +81,9 @@
([input n]
(when input
(let [{:keys [pos]} (get-caret-pos input)
pos (- pos n)]
pos (if (= n 1)
(util/safe-dec-current-pos-from-end (.-value input) pos)
(- pos n))]
(move-cursor-to input pos)))))
(defn- get-input-content&pos