Skip to content
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

fix: 防止中文输入法输入英文时触发提交 #6

Merged
merged 1 commit into from
Feb 12, 2023

Conversation

jjm2473
Copy link
Contributor

@jjm2473 jjm2473 commented Feb 11, 2023

部分输入法支持中英文混输,输入过程中按空格选择中文,按回车把当前的英文直接上屏。

至少在Chrome浏览器中,会把输入法选英文词的回车作为keyup事件,导致未输入完成的句子被提交。改成监听keypress事件就没问题了。 其他浏览器未测试。

部分输入法支持中英文混输,输入过程中按空格选择中文,按回车把当前的英文直接上屏。

至少在Chrome浏览器中,会把输入法选英文词的回车作为keyup事件,导致未输入完成的句子被提交。改成监听keypress事件就没问题了。
其他浏览器未测试。
@vercel
Copy link

vercel bot commented Feb 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
chatgpt-bot ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 11, 2023 at 3:52PM (UTC)

@Chanzhaoyu
Copy link
Owner

Chanzhaoyu commented Feb 11, 2023

@jjm2473

我以前好像解决过同样的问题,并且不是因为事件的问题,我再审查下。

Hello,看下这个文章

https://www.zhangxinxu.com/wordpress/2023/02/js-enter-submit-compositionupdate/

@Chanzhaoyu Chanzhaoyu merged commit ddec57f into Chanzhaoyu:main Feb 12, 2023
@jjm2473
Copy link
Contributor Author

jjm2473 commented Feb 12, 2023

我测试可以用keypress避免。如果还有兼容性问题,可能要参考你说的文章里面compositionstart方法

Soontao referenced this pull request in Soontao/Chatgpt-Web-Private Mar 25, 2023
yifangyujason pushed a commit to yifangyujason/chatgpt-web that referenced this pull request May 8, 2023
yifangyujason pushed a commit to yifangyujason/chatgpt-web that referenced this pull request May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants