Skip to content

Commit

Permalink
Fix editor.insertText never gets called inside plugins on Android (ia…
Browse files Browse the repository at this point in the history
…nstormtaylor#4753)

* Call Editor.insertText instead of Transforms.insertText to allow overriding by plugins

* Use Editor.insertText in android-input-manager

* changeset
  • Loading branch information
alessiogaldy authored and DougReeder committed Apr 3, 2022
1 parent 7152f69 commit be0b21a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-ears-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

Fix "editor.insertText never gets called inside plugins on android"
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ export class AndroidInputManager {
})
this.editor.marks = null
} else {
Transforms.insertText(this.editor, text, {
at,
})
Editor.insertText(this.editor, text)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ export const Editable = (props: EditableProps) => {
distance: currentTextNode.text.length,
reverse: true,
})
Transforms.insertText(editor, text)
Editor.insertText(editor, text)
})
}
}
Expand Down

0 comments on commit be0b21a

Please sign in to comment.