mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 06:31:28 +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:
5
.changeset/forty-mails-roll.md
Normal file
5
.changeset/forty-mails-roll.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
Fixed text insertion logic to prevent crashing in newer Firefox versions.
|
@@ -18,6 +18,7 @@ import useChildren from '../hooks/use-children'
|
||||
import Hotkeys from '../utils/hotkeys'
|
||||
import {
|
||||
IS_FIREFOX,
|
||||
IS_FIREFOX_LEGACY,
|
||||
IS_SAFARI,
|
||||
IS_EDGE_LEGACY,
|
||||
IS_CHROME_LEGACY,
|
||||
@@ -659,7 +660,7 @@ 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 && event.data) {
|
||||
if (!IS_SAFARI && !IS_FIREFOX_LEGACY && event.data) {
|
||||
Editor.insertText(editor, event.data)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user