mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 18:53:59 +02:00
Fix CJK IME(like Chinese, Japanese) double input (#4702)
* fix: resolve CJK IME double input * fix: resolve UC mobile no input issue * feat: add changeset * Update .changeset/large-melons-warn.md Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org> * fix: more specific way to deal with browsers Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
5
.changeset/large-melons-warn.md
Normal file
5
.changeset/large-melons-warn.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix CJK IME (e.g. Chinese or Japanese) double input
|
@@ -24,6 +24,8 @@ import {
|
|||||||
IS_FIREFOX_LEGACY,
|
IS_FIREFOX_LEGACY,
|
||||||
IS_QQBROWSER,
|
IS_QQBROWSER,
|
||||||
IS_SAFARI,
|
IS_SAFARI,
|
||||||
|
IS_UC_MOBILE,
|
||||||
|
IS_WECHATBROWSER,
|
||||||
CAN_USE_DOM,
|
CAN_USE_DOM,
|
||||||
} from '../utils/environment'
|
} from '../utils/environment'
|
||||||
import { ReactEditor } from '..'
|
import { ReactEditor } from '..'
|
||||||
@@ -772,6 +774,8 @@ export const Editable = (props: EditableProps) => {
|
|||||||
!IS_FIREFOX_LEGACY &&
|
!IS_FIREFOX_LEGACY &&
|
||||||
!IS_IOS &&
|
!IS_IOS &&
|
||||||
!IS_QQBROWSER &&
|
!IS_QQBROWSER &&
|
||||||
|
!IS_WECHATBROWSER &&
|
||||||
|
!IS_UC_MOBILE &&
|
||||||
event.data
|
event.data
|
||||||
) {
|
) {
|
||||||
Editor.insertText(editor, event.data)
|
Editor.insertText(editor, event.data)
|
||||||
|
@@ -43,6 +43,14 @@ export const IS_FIREFOX_LEGACY =
|
|||||||
export const IS_QQBROWSER =
|
export const IS_QQBROWSER =
|
||||||
typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent)
|
typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent)
|
||||||
|
|
||||||
|
// UC mobile browser
|
||||||
|
export const IS_UC_MOBILE =
|
||||||
|
typeof navigator !== 'undefined' && /.*UCBrowser/.test(navigator.userAgent)
|
||||||
|
|
||||||
|
// Wechat browser
|
||||||
|
export const IS_WECHATBROWSER =
|
||||||
|
typeof navigator !== 'undefined' && /.*Wechat/.test(navigator.userAgent)
|
||||||
|
|
||||||
// Check if DOM is available as React does internally.
|
// Check if DOM is available as React does internally.
|
||||||
// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
|
// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
|
||||||
export const CAN_USE_DOM = !!(
|
export const CAN_USE_DOM = !!(
|
||||||
|
Reference in New Issue
Block a user