refs #3300 Prevent input when suggest is opened

This commit is contained in:
AkiraFukushima 2022-05-02 21:56:15 +09:00
parent 88422646e7
commit e839513312
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
1 changed files with 6 additions and 1 deletions

View File

@ -109,10 +109,12 @@ export default defineComponent({
passive: false,
onEventFired(e) {
if (e.key === 'Enter' && suggestOpened.value) e.preventDefault()
if (e.key === 'ArrowUp' && suggestOpened.value) e.preventDefault()
if (e.key === 'ArrowDown' && suggestOpened.value) e.preventDefault()
}
})
const { modelValue } = toRefs(props)
const { modelValue, fixCursorPos } = toRefs(props)
const highlightedIndex = ref(0)
const statusRef = ref<HTMLTextAreaElement>()
const suggestRef = ref()
@ -150,6 +152,9 @@ export default defineComponent({
onMounted(() => {
nextTick(() => {
statusRef.value?.focus()
if (fixCursorPos.value) {
statusRef.value?.setSelectionRange(0, 0)
}
})
})