pull/3299/head
Mitja Bezenšek 2024-03-28 18:57:33 +01:00
rodzic aa6248a05f
commit a59ff81a7d
1 zmienionych plików z 19 dodań i 0 usunięć

Wyświetl plik

@ -390,6 +390,25 @@ function ShapesToDisplay() {
})
}
useEffect(() => {
function cleanContainerDivs() {
if (!wrapperDiv.current) return
const divIdsToRemove = new Set(portalInfo.keys())
const shapes = editor.getCurrentPageShapeIds()
shapes.forEach((shape) => {
divIdsToRemove.delete(shape)
})
divIdsToRemove.forEach((divId) => {
const pi = portalInfo.get(divId)
if (!pi) return
wrapperDiv.current?.removeChild(pi.container)
portalInfo.delete(divId)
})
}
const interval = setInterval(cleanContainerDivs, 1000)
return () => clearInterval(interval)
}, [editor])
return (
<div ref={wrapperDiv} id="portal-target">
{renderingShapes.map((result) => {