1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-21 13:51:59 +02:00

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.
This commit is contained in:
Jim Fisher 2022-10-12 13:18:32 +01:00 committed by GitHub
parent d39943741f
commit 1b14de5f8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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