editor: hide hover popup on editor destroy

This commit is contained in:
Abdullah Atta
2024-03-09 22:56:44 +05:00
parent 3a835ad90d
commit 1f5164660d

View File

@@ -38,6 +38,16 @@ export function HoverPopupHandler(props: FloatingMenuProps) {
const hoverTimeoutId = useRef<number>();
const activePopup = useRef<{ element: HTMLElement; hide: () => void }>();
useEffect(() => {
function onDestroy() {
activePopup.current?.hide();
}
editor.on("destroy", onDestroy);
return () => {
editor.off("destroy", onDestroy);
};
}, []);
useEffect(
() => {
function onMouseOver(e: MouseEvent) {