Skip to content

Commit c167740

Browse files
author
tangjinzhou
committed
fix: input not work at firefox #2151 #2215
1 parent abd1b7f commit c167740

File tree

10 files changed

+10
-19
lines changed

10 files changed

+10
-19
lines changed

components/_util/antInputDirective.js

-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,12 @@ function makeMap(str, expectsLowerCase) {
1717
const isTextInputType = makeMap('text,number,password,search,email,tel,url');
1818

1919
function onCompositionStart(e) {
20-
e.target.originPlaceholder = e.target.placeholder;
21-
e.target.placeholder = '';
2220
e.target.composing = true;
2321
}
2422

2523
function onCompositionEnd(e) {
2624
// prevent triggering an input event for no reason
2725
if (!e.target.composing) return;
28-
e.target.placeholder = e.target.originPlaceholder;
2926
e.target.composing = false;
3027
trigger(e.target, 'input');
3128
}

components/input/Input.jsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,9 @@ export default {
173173
});
174174
},
175175
handleChange(e) {
176-
if (e.inputType === 'insertCompositionText') {
177-
return;
178-
}
179176
const { value, composing } = e.target;
180177
// https://github.com/vueComponent/ant-design-vue/issues/2203
181-
if ((composing && this.lazy) || this.stateValue === value) return;
178+
if (((e.isComposing || composing) && this.lazy) || this.stateValue === value) return;
182179
this.setValue(value, this.clearPasswordValueAttribute);
183180
resolveOnChange(this.$refs.input, e, this.onChange);
184181
},

components/input/TextArea.jsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ export default {
6969
this.$emit('input', e);
7070
},
7171
handleChange(e) {
72-
if (e.inputType === 'insertCompositionText') {
73-
return;
74-
}
7572
const { value, composing } = e.target;
76-
if ((composing && this.lazy) || this.stateValue === value) return;
73+
if (((e.isComposing || composing) && this.lazy) || this.stateValue === value) return;
7774

7875
this.setValue(e.target.value, () => {
7976
this.$refs.resizableTextArea.resizeTextarea();

components/vc-calendar/src/date/DateInput.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const DateInput = {
8585
onInputChange(e) {
8686
const { value: str, composing } = e.target;
8787
const { str: oldStr = '' } = this;
88-
if (composing || oldStr === str) return;
88+
if (e.isComposing || composing || oldStr === str) return;
8989

9090
const { disabledDate, format, selectedValue } = this.$props;
9191

components/vc-mentions/src/Mentions.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ const Mentions = {
7272
}
7373
this.$emit('change', value);
7474
},
75-
onChange({ target: { value, composing } }) {
76-
if (composing) return;
75+
onChange({ target: { value, composing }, isComposing }) {
76+
if (isComposing || composing) return;
7777
this.triggerChange(value);
7878
},
7979
onKeyDown(event) {

components/vc-pagination/Options.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default {
3333
},
3434
handleChange(e) {
3535
const { value, composing } = e.target;
36-
if (composing || this.goInputText === value) return;
36+
if (e.isComposing || composing || this.goInputText === value) return;
3737
this.setState({
3838
goInputText: value,
3939
});

components/vc-pagination/Pagination.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export default {
195195
}
196196
},
197197
handleKeyUp(e) {
198-
if (e.target.composing) return;
198+
if (e.isComposing || e.target.composing) return;
199199
const value = this.getValidValue(e);
200200
const stateCurrentInputValue = this.stateCurrentInputValue;
201201

components/vc-select/Select.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ const Select = {
323323
onInputChange(e) {
324324
const { value: val, composing } = e.target;
325325
const { _inputValue = '' } = this.$data;
326-
if (composing || _inputValue === val) {
326+
if (e.isComposing || composing || _inputValue === val) {
327327
this.setState({
328328
_mirrorInputValue: val,
329329
});

components/vc-time-picker/Header.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const Header = {
6161
onInputChange(e) {
6262
const { value: str, composing } = e.target;
6363
const { str: oldStr = '' } = this;
64-
if (composing || oldStr === str) return;
64+
if (e.isComposing || composing || oldStr === str) return;
6565

6666
this.setState({
6767
str,

components/vc-tree-select/src/SearchInput.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const SearchInput = {
9898
handleInputChange(e) {
9999
const { value, composing } = e.target;
100100
const { searchValue = '' } = this;
101-
if (composing || searchValue === value) {
101+
if (e.isComposing || composing || searchValue === value) {
102102
this.mirrorSearchValue = value;
103103
return;
104104
}

0 commit comments

Comments
 (0)