mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-01 05:16:10 +01:00
fix(content): use handlers that actually exist in event listeners (#2131)
* fix(content): use handlers that actually exist in event listeners In a recent change, handlers now only exist in `Content#handlers`, but there were still a couple of places where they were being dereferenced directly from the instance. This was causing some side effects in iOS. Fixes #2125 Fixes #2129 * fix(content): also fix removeEventListeners
This commit is contained in:
parent
ec42b18108
commit
9d0546fad3
@ -91,13 +91,13 @@ class Content extends React.Component {
|
||||
|
||||
window.document.addEventListener(
|
||||
'selectionchange',
|
||||
this.onNativeSelectionChange
|
||||
this.handlers.onNativeSelectionChange
|
||||
)
|
||||
|
||||
// COMPAT: Restrict scope of `beforeinput` to clients that support the
|
||||
// Input Events Level 2 spec, since they are preventable events.
|
||||
if (HAS_INPUT_EVENTS_LEVEL_2) {
|
||||
this.element.addEventListener('beforeinput', this.onBeforeInput)
|
||||
this.element.addEventListener('beforeinput', this.handlers.onBeforeInput)
|
||||
}
|
||||
|
||||
this.updateSelection()
|
||||
@ -113,12 +113,15 @@ class Content extends React.Component {
|
||||
if (window) {
|
||||
window.document.removeEventListener(
|
||||
'selectionchange',
|
||||
this.onNativeSelectionChange
|
||||
this.handlers.onNativeSelectionChange
|
||||
)
|
||||
}
|
||||
|
||||
if (HAS_INPUT_EVENTS_LEVEL_2) {
|
||||
this.element.removeEventListener('beforeinput', this.onBeforeInput)
|
||||
this.element.removeEventListener(
|
||||
'beforeinput',
|
||||
this.handlers.onBeforeInput
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user