From 91a48146eda92f2bc844f93bb9e76d8e965400ae Mon Sep 17 00:00:00 2001 From: Alessio Galdy Date: Thu, 30 Dec 2021 16:29:18 +0100 Subject: [PATCH 1/3] Call Editor.insertText instead of Transforms.insertText to allow overriding by plugins --- .../slate-react/src/components/android/android-editable.tsx | 4 +--- packages/slate-react/src/components/editable.tsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/slate-react/src/components/android/android-editable.tsx b/packages/slate-react/src/components/android/android-editable.tsx index e047632c1e..e98798388e 100644 --- a/packages/slate-react/src/components/android/android-editable.tsx +++ b/packages/slate-react/src/components/android/android-editable.tsx @@ -560,9 +560,7 @@ export const AndroidEditable = (props: EditableProps): JSX.Element => { }) editor.marks = null } else { - Transforms.insertText(editor, text, { - at, - }) + Editor.insertText(editor, text) } }) }, RESOLVE_DELAY) diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 7cb059b9bf..12d9ccf551 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -793,7 +793,7 @@ export const Editable = (props: EditableProps) => { distance: currentTextNode.text.length, reverse: true, }) - Transforms.insertText(editor, text) + Editor.insertText(editor, text) }) } } From 12ff6beb275ac39c635055d84dd0624ecdb65c43 Mon Sep 17 00:00:00 2001 From: Alessio Galdy Date: Thu, 30 Dec 2021 16:42:40 +0100 Subject: [PATCH 2/3] Use Editor.insertText in android-input-manager --- .../src/components/android/android-input-manager.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/slate-react/src/components/android/android-input-manager.ts b/packages/slate-react/src/components/android/android-input-manager.ts index 8b446d00e9..6527fd5615 100644 --- a/packages/slate-react/src/components/android/android-input-manager.ts +++ b/packages/slate-react/src/components/android/android-input-manager.ts @@ -134,9 +134,7 @@ export class AndroidInputManager { }) this.editor.marks = null } else { - Transforms.insertText(this.editor, text, { - at, - }) + Editor.insertText(this.editor, text) } }) } From 5880553fcb7b85652cebed7b25a985ef931427ad Mon Sep 17 00:00:00 2001 From: Alessio Galdy Date: Thu, 30 Dec 2021 16:59:51 +0100 Subject: [PATCH 3/3] changeset --- .changeset/breezy-ears-happen.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/breezy-ears-happen.md diff --git a/.changeset/breezy-ears-happen.md b/.changeset/breezy-ears-happen.md new file mode 100644 index 0000000000..4b700de027 --- /dev/null +++ b/.changeset/breezy-ears-happen.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Fix "editor.insertText never gets called inside plugins on android"