Skip to content

fix(mentions): chinese or japanese input error #4520

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

fix(mentions): chinese or japanese input error #4520

wants to merge 1 commit into from

Conversation

mehunk
Copy link
Contributor

@mehunk mehunk commented Aug 15, 2021

首先,感谢你的贡献! 😄

新特性请提交至 feature 分支,其余可提交至 master 分支。在一个维护者审核通过后合并。请确保填写以下 pull request 的信息,谢谢!~

[English Template / 英文模板]

这个变动的性质是

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 组件样式改进
  • TypeScript 定义更新
  • 重构
  • 代码风格优化
  • 分支合并
  • 其他改动(是关于什么的改动?)

需求背景

  1. 我自己在使用过程中发现的问题,mentions 组件在输入中文或者日文字符时每次都会有吞字的现象出现
  2. 解决在输入中文或者日文字符时吞字的问题

实现方案和 API(非新功能可选)

  1. 我能想到的是两种解决方案。一种是在 onKeyUp 判断 event.target 的 composing 属性,如果是 true 证明当前正在输入中文或日文字符,这时不做处理直接返回。另外一种就是我现在提交的这个解决方案,在输入的过程中不去判断是否是中文或者日文字体,我看 ant design react 也是这么做的,因此采取了这个解决方案。

对用户的影响和可能的风险(非新功能可选)

  1. 这个改动对用户端是否有影响?影响的方面有哪些?
  2. 是否有可能隐含的 break change 和其他风险?

Changelog 描述(非新功能可选)

  1. 英文描述
  2. 中文描述(可选)

请求合并前的自查清单

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

后续计划(非新功能可选)

如果这个提交后面还有相关的其他提交和跟进信息,可以写在这里。

@tangjinzhou
Copy link
Member

用第一种吧

@mehunk
Copy link
Contributor Author

mehunk commented Aug 15, 2021

两种方案都有取舍,用第一种的话,在输入拼音的时候因为不会触发change和search,设置的filterOption,以及 search 的回调函数在输入拼音的时候不会触发,如果你觉得可以接受的话我就改成这种。
第一种的修改我已经提了 mr 了,在 #4524

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants