feat: add files popover in note toolbar (#913)

This commit is contained in:
Aman Harwara
2022-03-10 13:51:28 +05:30
committed by GitHub
parent 87631dcb0d
commit b31afee108
18 changed files with 1269 additions and 105 deletions

View File

@@ -46,8 +46,13 @@ export function useCloseOnClickOutside(
if (!container.current) {
return;
}
const isDescendant = container.current.contains(event.target as Node);
if (!isDescendant) {
const isDescendantOfContainer = container.current.contains(
event.target as Node
);
const isDescendantOfDialog = (event.target as HTMLElement).closest(
'[role="dialog"]'
);
if (!isDescendantOfContainer && !isDescendantOfDialog) {
callback();
}
},