1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-09 16:56:36 +02:00
Bryan Haakman
2022-03-09 03:40:50 +01:00
committed by GitHub
parent 1356f2afc3
commit 4d28948b90

View File

@@ -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)