1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 18:39:51 +02:00

fix to restrict window blur/focus handling, closes #773

This commit is contained in:
Ian Storm Taylor
2017-05-03 18:48:42 -07:00
parent f212ea3616
commit 0fcb953015
3 changed files with 10 additions and 2 deletions

View File

@@ -15,6 +15,7 @@
"immutable": "^3.8.1",
"is-empty": "^1.0.0",
"is-in-browser": "^1.1.3",
"is-window": "^1.0.2",
"keycode": "^2.1.2",
"prop-types": "^15.5.8",
"react-portal": "^3.0.0",

View File

@@ -3,6 +3,7 @@ import Debug from 'debug'
import React from 'react'
import Types from 'prop-types'
import getWindow from 'get-window'
import isWindow from 'is-window'
import keycode from 'keycode'
import TYPES from '../constants/types'
@@ -825,7 +826,8 @@ class Content extends React.Component {
* @param {Event} event
*/
onWindowBlur = (e) => {
onWindowBlur = (event) => {
if (!isWindow(event.target)) return
debug('onWindowBlur')
this.tmp.isWindowFocused = false
}
@@ -836,7 +838,8 @@ class Content extends React.Component {
* @param {Event} event
*/
onWindowFocus = (e) => {
onWindowFocus = (event) => {
if (!isWindow(event.target)) return
debug('onWindowFocus')
this.tmp.isWindowFocused = true
}

View File

@@ -3374,6 +3374,10 @@ is-utf8@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72"
is-window@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-window/-/is-window-1.0.2.tgz#2c896ca53db97de45d3c33133a65d8c9f563480d"
isarray@0.0.1, isarray@~0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"