mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-18 13:11:17 +02:00
Avoid crash in updateSelection() in content when window.getSelection() returns null (#2163)
This commit is contained in:
committed by
Ian Storm Taylor
parent
dbf35f2565
commit
222f746e85
@@ -144,6 +144,11 @@ class Content extends React.Component {
|
|||||||
const { isBackward } = selection
|
const { isBackward } = selection
|
||||||
const window = getWindow(this.element)
|
const window = getWindow(this.element)
|
||||||
const native = window.getSelection()
|
const native = window.getSelection()
|
||||||
|
|
||||||
|
// .getSelection() can return null in some cases
|
||||||
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=827585
|
||||||
|
if (!native) return
|
||||||
|
|
||||||
const { rangeCount, anchorNode } = native
|
const { rangeCount, anchorNode } = native
|
||||||
|
|
||||||
// If both selections are blurred, do nothing.
|
// If both selections are blurred, do nothing.
|
||||||
|
Reference in New Issue
Block a user