fix(editor): don't open the completion popup on deletion
Backspace/delete/cut emit an input event too, which reopened the popup mid-edit. Skip the refresh on any delete inputType.
This commit is contained in:
@@ -147,6 +147,12 @@ function escapeHtml(s: string): string {
|
|||||||
|
|
||||||
function onInput(e: Event) {
|
function onInput(e: Event) {
|
||||||
emit("update:modelValue", (e.target as HTMLTextAreaElement).value)
|
emit("update:modelValue", (e.target as HTMLTextAreaElement).value)
|
||||||
|
// Deleting text (backspace, forward-delete, cut) shouldn't summon the popup —
|
||||||
|
// the author is removing, not asking for suggestions. Close it and stop.
|
||||||
|
if ((e as InputEvent).inputType?.startsWith("delete")) {
|
||||||
|
completion.value = null
|
||||||
|
return
|
||||||
|
}
|
||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user