fix: insertion cursor position is incorrect

This commit is contained in:
molvqingtai 2024-10-31 00:14:59 +08:00
parent 7b91944fbf
commit 2987c2d85d
2 changed files with 3 additions and 1 deletions

View file

@ -3,7 +3,6 @@ import { version } from '@/../package.json'
export const EMOJI_LIST = [ export const EMOJI_LIST = [
'😀', '😀',
'😃',
'😄', '😄',
'😁', '😁',
'😆', '😆',
@ -113,6 +112,7 @@ export const EMOJI_LIST = [
'👽', '👽',
'👾', '👾',
'🤖', '🤖',
'👀',
'😺', '😺',
'😸', '😸',
'😹', '😹',

View file

@ -20,12 +20,14 @@ const useCursorPosition = () => {
handleRef.current.removeEventListener('input', handler) handleRef.current.removeEventListener('input', handler)
handleRef.current.removeEventListener('keydown', handler) handleRef.current.removeEventListener('keydown', handler)
handleRef.current.removeEventListener('keyup', handler) handleRef.current.removeEventListener('keyup', handler)
handleRef.current.removeEventListener('focus', handler)
} }
if (node) { if (node) {
node.addEventListener('click', handler) node.addEventListener('click', handler)
node.addEventListener('input', handler) node.addEventListener('input', handler)
node.addEventListener('keydown', handler) node.addEventListener('keydown', handler)
node.addEventListener('keyup', handler) node.addEventListener('keyup', handler)
node.addEventListener('focus', handler)
} }
handleRef.current = node handleRef.current = node
}, },