1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-22 15:02:51 +02:00

Update IS_FIREFOX_LEGACY flag to prevent FF crash (#4237)

* Update IS_FIREFOX_LEGACY flag to prevent FF crash

#4118 and #4150 introduced IS_FIREFOX_LEGACY, but this block of code was not updated to reflect that. This breaks insertion of emoji and unicode characters in slate-react. This change fixes #3855.

* Update editable.tsx

* Create forty-mails-roll.md

* Update editable.tsx

Apologies, in my tests I was using yarn patch and didn't need to modify the import statement, hopefully this will pass CI now.

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
This commit is contained in:
Dylan Schiemann
2021-05-05 16:56:10 -07:00
committed by GitHub
parent 3b3c94a72c
commit 623960a7d1
2 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'slate-react': patch
---
Fixed text insertion logic to prevent crashing in newer Firefox versions.

View File

@@ -18,6 +18,7 @@ import useChildren from '../hooks/use-children'
import Hotkeys from '../utils/hotkeys' import Hotkeys from '../utils/hotkeys'
import { import {
IS_FIREFOX, IS_FIREFOX,
IS_FIREFOX_LEGACY,
IS_SAFARI, IS_SAFARI,
IS_EDGE_LEGACY, IS_EDGE_LEGACY,
IS_CHROME_LEGACY, IS_CHROME_LEGACY,
@@ -659,7 +660,7 @@ 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 && event.data) { if (!IS_SAFARI && !IS_FIREFOX_LEGACY && event.data) {
Editor.insertText(editor, event.data) Editor.insertText(editor, event.data)
} }
} }