fix #687
This commit is contained in:
parent
69004168e0
commit
fc3f46a343
|
@ -44,11 +44,17 @@ export default memo(function Text ({ nofollow, imgproxyUrls, children, tab, ...o
|
|||
setOverflowing(container.scrollHeight > window.innerHeight * 2)
|
||||
}
|
||||
|
||||
let resizeObserver
|
||||
if (!overflowing && 'ResizeObserver' in window) {
|
||||
resizeObserver = new window.ResizeObserver(checkOverflow).observe(container)
|
||||
}
|
||||
|
||||
window.addEventListener('resize', checkOverflow)
|
||||
checkOverflow()
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('resize', checkOverflow)
|
||||
resizeObserver?.disconnect()
|
||||
}
|
||||
}, [containerRef.current, setOverflowing])
|
||||
|
||||
|
|
Loading…
Reference in New Issue