From 4315c3d194dabf58d6cfbd5529aacf419217b2dd Mon Sep 17 00:00:00 2001 From: BitPhinix Date: Wed, 26 Jan 2022 17:01:51 +0100 Subject: [PATCH] fix: flush onDOMSelectionChange on onDOMBeforeInput --- .changeset/wise-kings-serve.md | 5 +++++ packages/slate-react/src/components/editable.tsx | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/wise-kings-serve.md diff --git a/.changeset/wise-kings-serve.md b/.changeset/wise-kings-serve.md new file mode 100644 index 0000000000..8df303df17 --- /dev/null +++ b/.changeset/wise-kings-serve.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Flush onDOMSelectionChange on onDOMBeforeInput diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 0d0ddea9fc..603245a3c3 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -330,6 +330,7 @@ export const Editable = (props: EditableProps) => { // triggering a `beforeinput` expecting the change to be applied to the immediately before // set selection. scheduleOnDOMSelectionChange.flush() + onDOMSelectionChange.flush() const { selection } = editor const { inputType: type } = event