From 7ba486aa397411a3e83ab636b0982167d95319c0 Mon Sep 17 00:00:00 2001 From: David Ruisinger Date: Mon, 27 Sep 2021 18:05:39 +0200 Subject: [PATCH] Do NOT use exact match when updating dom selection (#4304) * Do NOT use exact match when updating dom selection * Added changeset --- .changeset/sour-nails-double.md | 5 +++++ packages/slate-react/src/components/editable.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/sour-nails-double.md diff --git a/.changeset/sour-nails-double.md b/.changeset/sour-nails-double.md new file mode 100644 index 000000000..bfceac36e --- /dev/null +++ b/.changeset/sour-nails-double.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Fixed a bug where text was typed backwards within nested editor diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 4bece19a1..872bec892 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -182,7 +182,7 @@ export const Editable = (props: EditableProps) => { // If the DOM selection is in the editor and the editor selection is already correct, we're done. if (hasDomSelection && hasDomSelectionInEditor && selection) { const slateRange = ReactEditor.toSlateRange(editor, domSelection, { - exactMatch: true, + exactMatch: false, }) if (slateRange && Range.equals(slateRange, selection)) { return