From 6c8442272105ec78b88d38efecb7aab9bb4e41de Mon Sep 17 00:00:00 2001 From: Ulion Date: Fri, 6 Aug 2021 11:58:46 +0800 Subject: [PATCH] Fix ios chrome ime double input issue. (#4049) * Fix ios chrome ime double input issue. * add changeset * pretty fix. Co-authored-by: Dylan Schiemann Thanks @ulion! --- .changeset/metal-trees-rest.md | 6 ++++++ packages/slate-react/src/components/editable.tsx | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/metal-trees-rest.md diff --git a/.changeset/metal-trees-rest.md b/.changeset/metal-trees-rest.md new file mode 100644 index 0000000000..bd0fd49bca --- /dev/null +++ b/.changeset/metal-trees-rest.md @@ -0,0 +1,6 @@ +--- +'slate-react': patch +'slate': patch +--- + +Fix ios chrome ime double input issue. diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 7b13344a8f..39dd8d9631 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -17,6 +17,7 @@ import useChildren from '../hooks/use-children' import Hotkeys from '../utils/hotkeys' import { HAS_BEFORE_INPUT_SUPPORT, + IS_IOS, IS_CHROME, IS_FIREFOX, IS_FIREFOX_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_LEGACY && event.data) { + if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && event.data) { Editor.insertText(editor, event.data) } }