fix: fix wxwork(wechatwork) ime can not work #5496
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
slate/packages/slate-react/src/components/editable.tsx
Lines 1133 to 1141 in a25d7a4
slate/packages/slate-react/src/utils/environment.ts
Lines 56 to 57 in a25d7a4
/.*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
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)yarn changeset add
.)