fix: prevent keyboard events during IME composition (#1535)
This commit is contained in:
parent
1af48aacb9
commit
d7d3078de5
|
|
@ -49,6 +49,9 @@ function onKeyDown(e: KeyboardEvent) {
|
|||
if (focusedRowIndex.value === null || focusedCellIndex.value === null) return
|
||||
|
||||
if (e.key === 'Enter') {
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
emit('enterPressed', { row: focusedRow.value!, cell: focusedCellIndex.value })
|
||||
return
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ function onFocus() {
|
|||
|
||||
function onKeyDown(e: KeyboardEvent) {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
onSelect()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ export default {
|
|||
}
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
if (event.isComposing) {
|
||||
return false
|
||||
}
|
||||
this.enterHandler()
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,6 +233,10 @@ export default function suggestionSetup(t) {
|
|||
|
||||
onKeyDown(props) {
|
||||
if (props.event.key === 'Escape') {
|
||||
if (props.event.isComposing) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (popupElement) {
|
||||
popupElement.style.display = 'none'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ function onKeyDown({event}: { event: KeyboardEvent }) {
|
|||
}
|
||||
|
||||
if (event.key === 'Enter') {
|
||||
if (event.isComposing) {
|
||||
return false
|
||||
}
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
enterHandler()
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@ watchEffect(() => {
|
|||
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') {
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
emit('close')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@
|
|||
class="title input"
|
||||
:contenteditable="(bucketTitleEditable && canWrite && !collapsedBuckets[bucket.id]) ? true : undefined"
|
||||
:spellcheck="false"
|
||||
@keydown.enter.prevent.stop="($event.target as HTMLElement).blur()"
|
||||
@keydown.esc.prevent.stop="($event.target as HTMLElement).blur()"
|
||||
@keydown.enter.prevent.stop="!$event.isComposing && ($event.target as HTMLElement).blur()"
|
||||
@keydown.esc.prevent.stop="!$event.isComposing && ($event.target as HTMLElement).blur()"
|
||||
@blur="saveBucketTitle(bucket.id, ($event.target as HTMLElement).textContent as string)"
|
||||
@click="focusBucketTitle"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -314,6 +314,9 @@ function handleListNavigation(e: KeyboardEvent) {
|
|||
}
|
||||
|
||||
if (e.key === 'Enter') {
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
taskRefs.value[focusedIndex.value]?.click(e)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,6 +270,10 @@ function handleEnter(e: KeyboardEvent) {
|
|||
return
|
||||
}
|
||||
|
||||
if (e.isComposing) {
|
||||
return
|
||||
}
|
||||
|
||||
e.preventDefault()
|
||||
addTask()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@
|
|||
:contenteditable="canWrite ? true : undefined"
|
||||
:spellcheck="false"
|
||||
@blur="save(($event.target as HTMLInputElement).textContent as string)"
|
||||
@keydown.enter.prevent.stop="($event.target as HTMLInputElement).blur()"
|
||||
@keydown.esc.prevent.stop="cancel($event.target as HTMLInputElement)"
|
||||
@keydown.enter.prevent.stop="!$event.isComposing && ($event.target as HTMLInputElement).blur()"
|
||||
@keydown.esc.prevent.stop="!$event.isComposing && cancel($event.target as HTMLInputElement)"
|
||||
>
|
||||
{{ task.title.trim() }}
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ export default function inputPrompt(pos: ClientRect, oldValue: string = ''): Pro
|
|||
return
|
||||
}
|
||||
|
||||
if (event.isComposing) {
|
||||
return
|
||||
}
|
||||
|
||||
const url = (event.target as HTMLInputElement).value
|
||||
|
||||
resolve(url)
|
||||
|
|
|
|||
Loading…
Reference in New Issue