diff --git a/.changeset/forty-mails-roll.md b/.changeset/forty-mails-roll.md new file mode 100644 index 0000000000..088ab2ce83 --- /dev/null +++ b/.changeset/forty-mails-roll.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Fixed text insertion logic to prevent crashing in newer Firefox versions. diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index f2a8a22faf..e08d2ebd5d 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -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) } }