Skip to content

fix[TextArea|Input|Mentions]: Fixed cursor issue when component under isComposing state. #7516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/input/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default defineComponent({
const { composing } = e.target as any;
let triggerValue = (e.target as any).value;
compositing.value = !!((e as any).isComposing && composing);
if ((compositing.value && props.lazy) || stateValue.value === triggerValue) return;
if (stateValue.value === triggerValue) return;

if (hasMaxLength.value) {
// 1. 复制粘贴超过maxlength的情况 2.未超过maxlength的情况
Expand Down
4 changes: 2 additions & 2 deletions components/vc-input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export default defineComponent({
});
};
const handleChange = (e: ChangeEvent) => {
const { value, composing } = e.target as any;
const { value } = e.target as any;
// https://github.com/vueComponent/ant-design-vue/issues/2203
if (((e as any).isComposing && composing && props.lazy) || stateValue.value === value) return;
if (stateValue.value === value) return;
const newVal = e.target.value;
resolveOnChange(inputRef.value, e, triggerChange);
setValue(newVal);
Expand Down
3 changes: 1 addition & 2 deletions components/vc-mentions/src/Mentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export default defineComponent({
emit('change', val);
};

const onChange: EventHandler = ({ target: { value, composing }, isComposing }) => {
if (isComposing || composing) return;
const onChange: EventHandler = ({ target: { value } }) => {
triggerChange(value);
};

Expand Down