mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 13:11:17 +02:00
fix: chinese input double in qq browser (#4452)
* fix: chinese input double in qq browser * add changeset * update changeset
This commit is contained in:
@@ -21,6 +21,7 @@ import {
|
||||
IS_CHROME,
|
||||
IS_FIREFOX,
|
||||
IS_FIREFOX_LEGACY,
|
||||
IS_QQBROWSER,
|
||||
IS_SAFARI,
|
||||
} from '../utils/environment'
|
||||
import { ReactEditor } from '..'
|
||||
@@ -714,7 +715,13 @@ export const Editable = (props: EditableProps) => {
|
||||
// aren't correct and never fire the "insertFromComposition"
|
||||
// type that we need. So instead, insert whenever a composition
|
||||
// ends since it will already have been committed to the DOM.
|
||||
if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && event.data) {
|
||||
if (
|
||||
!IS_SAFARI &&
|
||||
!IS_FIREFOX_LEGACY &&
|
||||
!IS_IOS &&
|
||||
!IS_QQBROWSER &&
|
||||
event.data
|
||||
) {
|
||||
Editor.insertText(editor, event.data)
|
||||
}
|
||||
}
|
||||
|
@@ -39,6 +39,10 @@ export const IS_FIREFOX_LEGACY =
|
||||
navigator.userAgent
|
||||
)
|
||||
|
||||
// qq browser
|
||||
export const IS_QQBROWSER =
|
||||
typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent)
|
||||
|
||||
// Check if DOM is available as React does internally.
|
||||
// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
|
||||
export const CAN_USE_DOM = !!(
|
||||
|
Reference in New Issue
Block a user