1
0
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:
Dylan Schiemann
2021-08-13 04:46:06 -07:00
committed by GitHub
parent 834ce3483d
commit 935b3a79d6
3 changed files with 17 additions and 1 deletions

View File

@@ -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)
}
}

View File

@@ -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 = !!(