Skip to content

Commit

Permalink
Invert #4755 (#4874)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanph authored Mar 9, 2022
1 parent 1356f2a commit 4d28948
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/slate-react/src/components/slate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@ export const Slate = (props: {
})

useIsomorphicLayoutEffect(() => {
const fn = () => {
setTimeout(() => {
if (unmountRef.current) {
return
}
setIsFocused(ReactEditor.isFocused(editor))
}, 0)
}
const fn = () => setIsFocused(ReactEditor.isFocused(editor))
document.addEventListener('focus', fn, true)
return () => document.removeEventListener('focus', fn, true)
}, [])

useIsomorphicLayoutEffect(() => {
const fn = () => setIsFocused(ReactEditor.isFocused(editor))
document.addEventListener('blur', fn, true)
return () => {
document.removeEventListener('focus', fn, true)
Expand Down

0 comments on commit 4d28948

Please sign in to comment.