chore: correctly close modals and show toast after creating note from shared text

This commit is contained in:
Aman Harwara
2023-07-13 02:16:54 +05:30
parent 8294d0663f
commit 512b8d9fbc
7 changed files with 50 additions and 9 deletions

View File

@@ -1,5 +1,9 @@
export type DialogWithClose = HTMLDivElement & { close: () => void }
export const requestCloseAllOpenModalsAndPopovers = () => {
document.querySelectorAll('[role="dialog"], [data-popover]').forEach((element) => {
// We add the close method to dialog & popovers to allow us to
// close them from anywhere in the app.
if ('close' in element && typeof element.close === 'function') {
element.close()
}