From 2987c2d85dd84639c06848ddc5cd4dc0b3288538 Mon Sep 17 00:00:00 2001 From: molvqingtai Date: Thu, 31 Oct 2024 00:14:59 +0800 Subject: [PATCH] fix: insertion cursor position is incorrect --- src/constants/config.ts | 2 +- src/hooks/useCursorPosition.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/constants/config.ts b/src/constants/config.ts index 1d10a7c..78c8786 100644 --- a/src/constants/config.ts +++ b/src/constants/config.ts @@ -3,7 +3,6 @@ import { version } from '@/../package.json' export const EMOJI_LIST = [ '😀', - '😃', '😄', '😁', '😆', @@ -113,6 +112,7 @@ export const EMOJI_LIST = [ '👽', '👾', '🤖', + '👀', '😺', '😸', '😹', diff --git a/src/hooks/useCursorPosition.ts b/src/hooks/useCursorPosition.ts index 80c3511..97b00f5 100644 --- a/src/hooks/useCursorPosition.ts +++ b/src/hooks/useCursorPosition.ts @@ -20,12 +20,14 @@ const useCursorPosition = () => { handleRef.current.removeEventListener('input', handler) handleRef.current.removeEventListener('keydown', handler) handleRef.current.removeEventListener('keyup', handler) + handleRef.current.removeEventListener('focus', handler) } if (node) { node.addEventListener('click', handler) node.addEventListener('input', handler) node.addEventListener('keydown', handler) node.addEventListener('keyup', handler) + node.addEventListener('focus', handler) } handleRef.current = node },