1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-16 12:14:14 +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:
陈耀耀
2023-03-03 01:11:19 +08:00
committed by GitHub
parent 96ad964bee
commit 4205e0f002
2 changed files with 11 additions and 1 deletions

View File

@@ -37,6 +37,11 @@ export const IS_CHROME_LEGACY =
typeof navigator !== 'undefined' &&
/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`.
export const IS_FIREFOX_LEGACY =
typeof navigator !== 'undefined' &&
@@ -63,7 +68,7 @@ export const CAN_USE_DOM = !!(
// COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event
// Chrome Legacy doesn't support `beforeinput` correctly
export const HAS_BEFORE_INPUT_SUPPORT =
!IS_CHROME_LEGACY &&
(!IS_CHROME_LEGACY || !IS_ANDROID_CHROME_LEGACY) &&
!IS_EDGE_LEGACY &&
// globalThis is undefined in older browsers
typeof globalThis !== 'undefined' &&