mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-09 16:56:36 +02:00
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user