mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
Fix the issue of composition API and beforeinput event triggering between Chrome versions 60-75 on the Android platform. (#5327)
* fix: The issue of composition API and beforeinput event triggering between Chrome versions 60-75 on the Android platform. * feat: add changeset * fix: update the logic of HAS_BEFORE_INPUT_SUPPORT
This commit is contained in:
5
.changeset/new-dryers-stare.md
Normal file
5
.changeset/new-dryers-stare.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix the issue of composition API and beforeinput event triggering between Chrome versions 60-75 on the Android platform.
|
@@ -37,6 +37,11 @@ export const IS_CHROME_LEGACY =
|
|||||||
typeof navigator !== 'undefined' &&
|
typeof navigator !== 'undefined' &&
|
||||||
/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent)
|
/Chrome?\/(?:[0-7][0-5]|[0-6][0-9])(?:\.)/i.test(navigator.userAgent)
|
||||||
|
|
||||||
|
export const IS_ANDROID_CHROME_LEGACY =
|
||||||
|
IS_ANDROID &&
|
||||||
|
typeof navigator !== 'undefined' &&
|
||||||
|
/Chrome?\/(?:[0-5]?\d)(?:\.)/i.test(navigator.userAgent)
|
||||||
|
|
||||||
// Firefox did not support `beforeInput` until `v87`.
|
// Firefox did not support `beforeInput` until `v87`.
|
||||||
export const IS_FIREFOX_LEGACY =
|
export const IS_FIREFOX_LEGACY =
|
||||||
typeof navigator !== 'undefined' &&
|
typeof navigator !== 'undefined' &&
|
||||||
@@ -63,7 +68,7 @@ export const CAN_USE_DOM = !!(
|
|||||||
// COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event
|
// COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event
|
||||||
// Chrome Legacy doesn't support `beforeinput` correctly
|
// Chrome Legacy doesn't support `beforeinput` correctly
|
||||||
export const HAS_BEFORE_INPUT_SUPPORT =
|
export const HAS_BEFORE_INPUT_SUPPORT =
|
||||||
!IS_CHROME_LEGACY &&
|
(!IS_CHROME_LEGACY || !IS_ANDROID_CHROME_LEGACY) &&
|
||||||
!IS_EDGE_LEGACY &&
|
!IS_EDGE_LEGACY &&
|
||||||
// globalThis is undefined in older browsers
|
// globalThis is undefined in older browsers
|
||||||
typeof globalThis !== 'undefined' &&
|
typeof globalThis !== 'undefined' &&
|
||||||
|
Reference in New Issue
Block a user