From 720d54f91deac699bbc2b605b36a467b63403fba Mon Sep 17 00:00:00 2001 From: baiy Date: Thu, 6 Jan 2022 23:18:36 +0800 Subject: [PATCH] fix: chinese pinyin input - fix #2039 (#2057) --- packages/hoppscotch-app/components/smart/EnvInput.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-app/components/smart/EnvInput.vue b/packages/hoppscotch-app/components/smart/EnvInput.vue index 3668fd9f4..c2cabfa83 100644 --- a/packages/hoppscotch-app/components/smart/EnvInput.vue +++ b/packages/hoppscotch-app/components/smart/EnvInput.vue @@ -17,6 +17,7 @@ @click="$emit('click', $event)" @keydown="$emit('keydown', $event)" @paste="handlePaste" + @compositionend="handleCompositionEnd" > @@ -72,7 +73,7 @@ export default defineComponent({ highlightEnabled: true, highlightStyle: "", caseSensitive: true, - fireOn: "keydown", + fireOn: "input", fireOnEnabled: true, } }, @@ -114,11 +115,17 @@ export default defineComponent({ }, methods: { + handleCompositionEnd() { + this.handleChange() + }, handlePaste(ev) { this.handleChange() this.$emit("paste", { event: ev, previousValue: this.internalValue }) }, - handleChange() { + handleChange(e = null) { + if (e && "inputType" in e && e.inputType === "insertCompositionText") { + return + } this.debouncedHandler = debounce(function () { if (this.$refs.editor) { if (this.internalValue !== this.$refs.editor.textContent) {