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: fix wxwork(wechatwork) ime can not work #5496

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

evilbs
Copy link

@evilbs evilbs commented Aug 15, 2023

Description:
Fix cannot input Chinese on wxwork(wechat work).

Example:
wechat and wxwork useragent:
Wechat usearagent:
Mozilla/5.0 (Linux; Android 13; 22127RK46C Build/TKQ1.220905.001; wv) AppleWebKit/537.36 (KHTML%2C like Gecko) Version/4.0 Chrome/107.0.5304.141 Mobile Safari/537.36 XWEB/5127 MMWEBSDK/20230604 MMWEBID/7189 MicroMessenger/8.0.38.2400(0x28002639) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 qcloudcdn-xinan

wxwork(wexin work) useraget:
Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.110 Safari/537.36 Language/zh wxwork/4.1.9 (MicroMessenger/6.2) WindowsWechat MailPlugin_Electron WeMail embeddisk

if (
!IS_WEBKIT &&
!IS_FIREFOX_LEGACY &&
!IS_IOS &&
!IS_WECHATBROWSER &&
!IS_UC_MOBILE &&
event.data
) {
const placeholderMarks = EDITOR_TO_PENDING_INSERTION_MARKS.get(

export const IS_WECHATBROWSER =
typeof navigator !== 'undefined' && /.*Wechat/.test(navigator.userAgent)

/.*Wechat/.test(navigator.userAgent)
This regex will also filter the useragent of the wxwork(weixin work), causing the wxwork unable receive the IME CompositionEnd event then cannot input Chinese.

Checks

  • The new code matches the existing patterns and styles.
  • The tests pass with yarn test.
  • The linter passes with yarn lint. (Fix errors with yarn fix.)
  • The relevant examples still work. (Run examples with yarn start.)
  • You've added a changeset if changing functionality. (Add one with yarn changeset add.)

@changeset-bot
Copy link

changeset-bot bot commented Aug 15, 2023

🦋 Changeset detected

Latest commit: 004e14f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@dylans dylans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evilbs could you please add a changeset per the guidelines and then we can release this update? Thanks

@evilbs
Copy link
Author

evilbs commented Aug 16, 2023

@dylans I have added the changeset. Please review it again. Thank you.

@evilbs evilbs closed this Aug 16, 2023
@evilbs evilbs reopened this Aug 16, 2023
@evilbs
Copy link
Author

evilbs commented Aug 16, 2023

Slate Can't input Chinese correctly and it carshed on wechat(windows wechat/mac wechat/wxwork)
mac:

7129_1692211073.mp4

win:
image

I fixed it and it ok on wechat(windows wechat/mac wechat/wxwork...)

7130_1692211252.mp4

so i want remove restrictions on wechat.

@dylans Please review it again. Thank you.

@evilbs evilbs requested a review from dylans August 21, 2023 11:20
@dylans
Copy link
Collaborator

dylans commented Aug 23, 2023

@evilbs It looks like #5497 solves this by excluding macos rather than all platforms. Could you verify if the solution in the other PR works for you or if this is the better solution?

@evilbs
Copy link
Author

evilbs commented Aug 27, 2023

@dylans PR #5497 doesn't resolve my issue. it is only resolved mac wechat. my case happend on window wechat browser and window wxwork browser.

window.wechat.mp4

but i found that browser of all platforms of all wechat products have the same problem.
WeChat and WxWork(Enterprise WeChat) are two products, but the wechat keyword exists in their useragent

i remove the restrictions, all wechat products can work fine. i checked all platforms and all wechat products.

@dylans
Copy link
Collaborator

dylans commented Aug 29, 2023

@evilbs, ok, but in that case it doesn't make sense to completely remove the utility function to check for the Wechat browser, but rather just not to use it here?

@evilbs
Copy link
Author

evilbs commented Aug 30, 2023

@dylans hi, I have restored the utility function, Just remove the check.

@dylans
Copy link
Collaborator

dylans commented Sep 5, 2023

This is failing our tests as I believe we need to update our minimum TS version. Will try to address this soon.

@dylans
Copy link
Collaborator

dylans commented Jun 25, 2024

Apologies, this one fell off my radar. @evilbs if you have time to clean it up, I'll review and land it.

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.

2 participants