Skip to content

Commit ed99c15

Browse files
MoonHyukoleksiikhr
authored andcommitted
Input: Fix Korean composition event (ElemeFE#15069)
1 parent 0f8586a commit ed99c15

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/input/src/input.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
:autocomplete="autoComplete || autocomplete"
3232
ref="input"
3333
@compositionstart="handleCompositionStart"
34+
@compositionupdate="handleCompositionUpdate"
3435
@compositionend="handleCompositionEnd"
3536
@input="handleInput"
3637
@focus="handleFocus"
@@ -87,6 +88,7 @@
8788
:tabindex="tabindex"
8889
class="el-textarea__inner"
8990
@compositionstart="handleCompositionStart"
91+
@compositionupdate="handleCompositionUpdate"
9092
@compositionend="handleCompositionEnd"
9193
@input="handleInput"
9294
ref="textarea"
@@ -109,6 +111,7 @@
109111
import Migrating from 'element-ui/src/mixins/migrating';
110112
import calcTextareaHeight from './calcTextareaHeight';
111113
import merge from 'element-ui/src/utils/merge';
114+
import {isKorean} from 'element-ui/src/utils/shared';
112115
113116
export default {
114117
name: 'ElInput',
@@ -336,9 +339,16 @@
336339
handleCompositionStart() {
337340
this.isComposing = true;
338341
},
342+
handleCompositionUpdate(event) {
343+
const text = event.target.value;
344+
const lastCharacter = text[text.length - 1] || '';
345+
this.isComposing = !isKorean(lastCharacter);
346+
},
339347
handleCompositionEnd(event) {
340-
this.isComposing = false;
341-
this.handleInput(event);
348+
if (this.isComposing) {
349+
this.isComposing = false;
350+
this.handleInput(event);
351+
}
342352
},
343353
handleInput(event) {
344354
// should not emit input during composition

0 commit comments

Comments
 (0)