We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc5a9d8 commit bd66bfaCopy full SHA for bd66bfa
.changeset/mean-pots-thank.md
@@ -0,0 +1,5 @@
1
+---
2
+'slate-react': patch
3
4
+
5
+Fix: `onValueChange` was not triggered when replacing text after selecting it from right to left.
packages/slate-react/src/components/editable.tsx
@@ -692,8 +692,18 @@ export const Editable = forwardRef(
692
exactMatch: false,
693
suppressThrow: false,
694
})
695
+ const flippedRange = {
696
+ anchor: range.focus,
697
+ focus: range.anchor,
698
+ }
699
- if (!selection || !Range.equals(selection, range)) {
700
+ if (
701
+ !selection ||
702
+ !(
703
+ Range.equals(selection, range) ||
704
+ Range.equals(selection, flippedRange)
705
+ )
706
+ ) {
707
native = false
708
709
const selectionRef =
0 commit comments