diff --git a/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx b/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx index f12deab63..878ceae1a 100644 --- a/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx +++ b/packages/editor/src/toolbar/floating-menus/hover-popup/index.tsx @@ -38,6 +38,16 @@ export function HoverPopupHandler(props: FloatingMenuProps) { const hoverTimeoutId = useRef(); 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) {