openerRef.current.style.height = `${cords.height}px`;
openerRef.current.click();
}
- const handleContextMenuOpen = (placement, cords, render) => {
+ const handleContextMenuOpen = (placement, cords, render, afterClose) => {
if (key) {
closeMenu();
return;
}
- setData({ placement, cords, render });
+ setData({
+ placement, cords, render, afterClose,
+ });
};
navigation.on(cons.events.navigation.REUSABLE_CONTEXT_MENU_OPENED, handleContextMenuOpen);
return () => {
key = Math.random();
return;
}
+ data?.afterClose?.();
if (setData) setData(null);
if (key === null) return;
});
}
-export function openReusableContextMenu(placement, cords, render) {
+export function openReusableContextMenu(placement, cords, render, afterClose) {
appDispatcher.dispatch({
type: cons.actions.navigation.OPEN_REUSABLE_CONTEXT_MENU,
placement,
cords,
render,
+ afterClose,
});
}