Skip to content

Commit

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

* 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 Jan 4, 2022
1 parent 735d2d0 commit e9a46ad
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 e9a46ad

Please sign in to comment.