add modal support, showModal->showContextMenu and new showModal

This commit is contained in:
AAGaming
2022-06-01 17:51:17 -04:00
parent 536269b1b7
commit 07ccceb990
5 changed files with 41 additions and 14 deletions

11
src/deck-components/Menu.tsx Normal file → Executable file
View File

@@ -1,7 +1,16 @@
import { FC } from 'react';
import { FC, ReactNode } from 'react';
import { findModuleChild } from '../webpack';
export const showContextMenu: (children: ReactNode, parent?: EventTarget) => void = findModuleChild((m) => {
if (typeof m !== 'object') return undefined;
for (let prop in m) {
if (typeof m[prop] === 'function' && m[prop].toString().includes('stopPropagation))')) {
return m[prop];
}
}
});
interface MenuProps {
label: string;
onCancel?(): void;