From 1b14de5f8e5961ac36eced229abea9abb5be71f9 Mon Sep 17 00:00:00 2001 From: Jim Fisher Date: Wed, 12 Oct 2022 13:18:32 +0100 Subject: [PATCH] Revert insertText breaking change that deletes fragment (fixes #5153) (#5154) This reverts commit 7499d4b4c01a089906a96f30f6c04256204ca65e. The issue reported at https://github.com/ianstormtaylor/slate/issues/4862 is a valid complaint, but change in https://github.com/ianstormtaylor/slate/pull/4868 is not an appropriate fix. It is a serious breaking change, reported as bug: https://github.com/ianstormtaylor/slate/issues/5153 We should therefore revert the change. If we wish to fix Chromium's triple-click bug, we should do so by unhanging the selection when it is created; not by changing insertText behavior. --- packages/slate-react/src/components/editable.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 40a5925655..3ad9d961c7 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -648,13 +648,6 @@ export const Editable = (props: EditableProps) => { case 'insertFromYank': case 'insertReplacementText': case 'insertText': { - const { selection } = editor - if (selection) { - if (Range.isExpanded(selection)) { - Editor.deleteFragment(editor) - } - } - if (type === 'insertFromComposition') { // COMPAT: in Safari, `compositionend` is dispatched after the // `beforeinput` for "insertFromComposition". But if we wait for it