1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-22 06:53:25 +02:00

fix(content): attach the right onNativeSelectionChange. (#2150)

This undoes a recent change https://github.com/ianstormtaylor/slate/pull/2131

Which hooked up `this.handlers.onNativeSelectionChange` to `'selectionchange'` as well as `this.handlers.onBeforeInput` to `'beforeinput'`.

It turns out that in order to fix the iOS issues, we only needed the change to `onBeforeInput`. The corect handler for `'selectionchange'` is the instance method `this.onNativeSelectionChange`. This broke a whole bunch of focus related issues.
This commit is contained in:
Eric Edem
2018-09-04 10:36:48 -07:00
committed by Ian Storm Taylor
parent a8cd10ba63
commit 3db717761e

View File

@@ -91,7 +91,7 @@ class Content extends React.Component {
window.document.addEventListener(
'selectionchange',
this.handlers.onNativeSelectionChange
this.onNativeSelectionChange
)
// COMPAT: Restrict scope of `beforeinput` to clients that support the
@@ -113,7 +113,7 @@ class Content extends React.Component {
if (window) {
window.document.removeEventListener(
'selectionchange',
this.handlers.onNativeSelectionChange
this.onNativeSelectionChange
)
}