+1
-2
packages/core-extensions/src/contextMenu/index.tsx
+1
-2
packages/core-extensions/src/contextMenu/index.tsx
···
5
find: "Menu API only allows Items and groups of Items as children.",
6
replace: [
7
{
8
-
match:
9
-
/(?<=let{navId[^}]+?}=(.),(.)=function .\(.\){.+(?=,.=function))/,
10
replacement: (_, props, items) =>
11
`,__contextMenu=!${props}.__contextMenu_evilMenu&&require("contextMenu_contextMenu")._patchMenu(${props}, ${items})`
12
}
···
5
find: "Menu API only allows Items and groups of Items as children.",
6
replace: [
7
{
8
+
match: /(?<=let{navId[^}]+?}=(.),(.)=.\(.\))/,
9
replacement: (_, props, items) =>
10
`,__contextMenu=!${props}.__contextMenu_evilMenu&&require("contextMenu_contextMenu")._patchMenu(${props}, ${items})`
11
}
+5
-6
packages/core-extensions/src/contextMenu/webpackModules/evilMenu.ts
+5
-6
packages/core-extensions/src/contextMenu/webpackModules/evilMenu.ts
···
6
"Menu API only allows Items and groups of Items as children."
7
)[0].id
8
].toString();
9
-
code = code.replace(/,.=(?=function .\(.\){.+?,.=function)/, ";return ");
10
-
code = code.replace(/,(?=__contextMenu)/, ";let ");
11
const mod = new Function(
12
"module",
13
"exports",
···
16
);
17
const exp: any = {};
18
mod({}, exp, require);
19
-
const Menu = spacepack.findFunctionByStrings(
20
-
exp,
21
-
"Menu API only allows Items and groups of Items as children."
22
-
)!;
23
module.exports = (el: any) => {
24
return Menu({
25
children: el,
···
6
"Menu API only allows Items and groups of Items as children."
7
)[0].id
8
].toString();
9
+
code = code.replace(
10
+
/onSelect:(.)}=(.),.=(.\(.\)),/,
11
+
`onSelect:$1}=$2;return $3;let `
12
+
);
13
const mod = new Function(
14
"module",
15
"exports",
···
18
);
19
const exp: any = {};
20
mod({}, exp, require);
21
+
const Menu = spacepack.findFunctionByStrings(exp, "isUsingKeyboardNavigation")!;
22
module.exports = (el: any) => {
23
return Menu({
24
children: el,
+55
-45
packages/types/src/coreExtensions/contextMenu.ts
+55
-45
packages/types/src/coreExtensions/contextMenu.ts
···
27
color?: string;
28
children: React.ReactComponentElement<MenuElement>[];
29
}>;
30
-
export type MenuItem = React.FunctionComponent<{
31
-
id: any;
32
-
dontCloseOnActionIfHoldingShiftKey?: boolean;
33
-
} & ({
34
-
label: string;
35
-
subtext?: string;
36
-
color?: string;
37
-
hint?: string;
38
-
disabled?: boolean;
39
-
icon?: any;
40
-
showIconFirst?: boolean;
41
-
imageUrl?: string;
42
43
-
className?: string;
44
-
focusedClassName?: string;
45
-
subMenuIconClassName?: string;
46
47
-
action?: () => void;
48
-
onFocus?: () => void;
49
50
-
iconProps?: any;
51
-
sparkle?: any;
52
53
-
children?: React.ReactComponentElement<MenuElement>[];
54
-
onChildrenScroll?: any;
55
-
childRowHeight?: any;
56
-
listClassName?: string;
57
-
subMenuClassName?: string;
58
-
} | {
59
-
color?: string;
60
-
disabled?: boolean;
61
-
keepItemStyles?: boolean;
62
63
-
action?: () => void;
64
65
-
render: any;
66
-
navigable?: boolean;
67
-
})>;
68
export type MenuCheckboxItem = React.FunctionComponent<{
69
id: any;
70
label: string;
···
84
disabled?: boolean;
85
action?: () => void;
86
}>;
87
-
export type MenuControlItem = React.FunctionComponent<{
88
-
id: any;
89
-
label: string;
90
-
color?: string;
91
-
disabled?: boolean;
92
-
showDefaultFocus?: boolean;
93
-
} & ({
94
-
control: any;
95
-
} | {
96
-
control?: undefined;
97
-
interactive?: boolean;
98
-
children?: React.ReactComponentElement<MenuElement>[];
99
-
})>;
100
/* eslint-disable prettier/prettier */
101
102
export type ContextMenu = {
···
27
color?: string;
28
children: React.ReactComponentElement<MenuElement>[];
29
}>;
30
+
export type MenuItem = React.FunctionComponent<
31
+
{
32
+
id: any;
33
+
dontCloseOnActionIfHoldingShiftKey?: boolean;
34
+
} & (
35
+
| {
36
+
label: string;
37
+
subtext?: string;
38
+
color?: string;
39
+
hint?: string;
40
+
disabled?: boolean;
41
+
icon?: any;
42
+
showIconFirst?: boolean;
43
+
imageUrl?: string;
44
45
+
className?: string;
46
+
focusedClassName?: string;
47
+
subMenuIconClassName?: string;
48
49
+
action?: () => void;
50
+
onFocus?: () => void;
51
52
+
iconProps?: any;
53
+
sparkle?: any;
54
55
+
children?: React.ReactComponentElement<MenuElement>[];
56
+
onChildrenScroll?: any;
57
+
childRowHeight?: any;
58
+
listClassName?: string;
59
+
subMenuClassName?: string;
60
+
}
61
+
| {
62
+
color?: string;
63
+
disabled?: boolean;
64
+
keepItemStyles?: boolean;
65
66
+
action?: () => void;
67
68
+
render: any;
69
+
navigable?: boolean;
70
+
}
71
+
)
72
+
>;
73
export type MenuCheckboxItem = React.FunctionComponent<{
74
id: any;
75
label: string;
···
89
disabled?: boolean;
90
action?: () => void;
91
}>;
92
+
export type MenuControlItem = React.FunctionComponent<
93
+
{
94
+
id: any;
95
+
label: string;
96
+
color?: string;
97
+
disabled?: boolean;
98
+
showDefaultFocus?: boolean;
99
+
} & (
100
+
| {
101
+
control: any;
102
+
}
103
+
| {
104
+
control?: undefined;
105
+
interactive?: boolean;
106
+
children?: React.ReactComponentElement<MenuElement>[];
107
+
}
108
+
)
109
+
>;
110
/* eslint-disable prettier/prettier */
111
112
export type ContextMenu = {