fix monaco

This commit is contained in:
Rizky 2024-04-09 16:14:25 +07:00
parent 67afa6b1a9
commit 2b238378e6
1 changed files with 5 additions and 5 deletions

View File

@ -157,7 +157,7 @@ export const EdScriptMonaco: FC<{}> = () => {
if (component.id) { if (component.id) {
const prop_name = p.ui.popup.script.prop_name; const prop_name = p.ui.popup.script.prop_name;
const prop = meta.item.component?.props[prop_name]; const prop = meta.item.component?.props[prop_name];
propTypings(prop, types); propTypings(prop, types, p.page.meta);
} }
} }
break; break;
@ -176,7 +176,7 @@ export const EdScriptMonaco: FC<{}> = () => {
if (component.id && meta.jsx_prop?.name) { if (component.id && meta.jsx_prop?.name) {
const prop_name = meta.jsx_prop.name; const prop_name = meta.jsx_prop.name;
const prop = component?.props[prop_name]; const prop = component?.props[prop_name];
propTypings(prop, types); propTypings(prop, types, p.page.meta);
} }
} }
break; break;
@ -381,16 +381,16 @@ export const EdScriptMonaco: FC<{}> = () => {
); );
}; };
const propTypings = (prop: FNCompDef | undefined, types: any) => { const propTypings = (prop: FNCompDef | undefined, types: any, meta: any) => {
if (!!prop && typeof prop.typings === "string") { if (!!prop && typeof prop.typings === "string") {
const typings_fn = new Function( const typings_fn = new Function(
"active", "active",
`\ "_meta"`\
${prop.typings}; ${prop.typings};
return typings;` return typings;`
); );
try { try {
const typings = typings_fn(active); const typings = typings_fn(active, meta);
if (typeof typings === "object") { if (typeof typings === "object") {
for (const [k, v] of Object.entries(typings)) { for (const [k, v] of Object.entries(typings)) {
if (typeof v === "string") { if (typeof v === "string") {