This commit is contained in:
Rizky 2024-04-14 12:36:00 +07:00
parent 2f459afaa0
commit 51e3a205b7
2 changed files with 11 additions and 4 deletions

View File

@ -85,11 +85,19 @@ export const declareScope = (p: PG, meta: IMeta, monaco: Monaco) => {
if (comp && comp.typings) { if (comp && comp.typings) {
try { try {
const fn = new Function(`\ const arg = {
...exports,
params,
};
const fn = new Function(
...Object.keys(arg),
`\
${comp.typings}; ${comp.typings};
return typings; return typings;
`); `
const result = fn(); );
const result = fn(...Object.values(arg));
if (typeof result === "object" && typeof result._raw === "object") { if (typeof result === "object" && typeof result._raw === "object") {
for (const [k, v] of Object.entries(result._raw) as any) { for (const [k, v] of Object.entries(result._raw) as any) {
comp_types[k] = v; comp_types[k] = v;

View File

@ -322,7 +322,6 @@ const treeClasses = {
placeholder: "placeholder", placeholder: "placeholder",
draggingSource: css` draggingSource: css`
background: #e4f0ff; background: #e4f0ff;
cursor: not-allowed; cursor: not-allowed;
`, `,
}; };