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:
5
.changeset/flat-carpets-sort.md
Normal file
5
.changeset/flat-carpets-sort.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
double ime fix for qq browser
|
@@ -21,6 +21,7 @@ import {
|
|||||||
IS_CHROME,
|
IS_CHROME,
|
||||||
IS_FIREFOX,
|
IS_FIREFOX,
|
||||||
IS_FIREFOX_LEGACY,
|
IS_FIREFOX_LEGACY,
|
||||||
|
IS_QQBROWSER,
|
||||||
IS_SAFARI,
|
IS_SAFARI,
|
||||||
} from '../utils/environment'
|
} from '../utils/environment'
|
||||||
import { ReactEditor } from '..'
|
import { ReactEditor } from '..'
|
||||||
@@ -714,7 +715,13 @@ export const Editable = (props: EditableProps) => {
|
|||||||
// aren't correct and never fire the "insertFromComposition"
|
// aren't correct and never fire the "insertFromComposition"
|
||||||
// type that we need. So instead, insert whenever a composition
|
// type that we need. So instead, insert whenever a composition
|
||||||
// ends since it will already have been committed to the DOM.
|
// 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)
|
Editor.insertText(editor, event.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -39,6 +39,10 @@ export const IS_FIREFOX_LEGACY =
|
|||||||
navigator.userAgent
|
navigator.userAgent
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// qq browser
|
||||||
|
export const IS_QQBROWSER =
|
||||||
|
typeof navigator !== 'undefined' && /.*QQBrowser/.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