do not trigger changes during IME composition.

This commit is contained in:
Miroslav Šedivý 2022-09-27 21:38:43 +02:00
parent d8829e40d8
commit 3a75b1bf54

View File

@ -5,9 +5,9 @@
ref="textarea" ref="textarea"
class="neko-overlay" class="neko-overlay"
:style="{ cursor }" :style="{ cursor }"
v-model="textInput"
@click.stop.prevent="wsControl.emit('overlay.click', $event)" @click.stop.prevent="wsControl.emit('overlay.click', $event)"
@contextmenu.stop.prevent="wsControl.emit('overlay.contextmenu', $event)" @contextmenu.stop.prevent="wsControl.emit('overlay.contextmenu', $event)"
@input.stop.prevent="onInput"
@wheel.stop.prevent="onWheel" @wheel.stop.prevent="onWheel"
@mousemove.stop.prevent="onMouseMove" @mousemove.stop.prevent="onMouseMove"
@mousedown.stop.prevent="onMouseDown" @mousedown.stop.prevent="onMouseDown"
@ -69,6 +69,7 @@
@Ref('textarea') readonly _textarea!: HTMLTextAreaElement @Ref('textarea') readonly _textarea!: HTMLTextAreaElement
private _ctx!: CanvasRenderingContext2D private _ctx!: CanvasRenderingContext2D
private textInput = ''
private keyboard = GuacamoleKeyboard() private keyboard = GuacamoleKeyboard()
private focused = false private focused = false
@ -246,9 +247,13 @@
return x return x
} }
onInput(e: InputEvent) { // use v-model instead of @input because v-model
this.wsControl.paste(this._textarea.value) // doesn't get updated during IME composition
this._textarea.value = '' @Watch('textInput')
onTextInputChange() {
if (this.textInput == '') return
this.wsControl.paste(this.textInput)
this.textInput = ''
} }
onWheel(e: WheelEvent) { onWheel(e: WheelEvent) {