From 178533d435e1593578400223da86bb30763d50e7 Mon Sep 17 00:00:00 2001 From: Rizky Date: Fri, 2 Feb 2024 14:21:03 +0700 Subject: [PATCH] wip fix --- .../src/nova/ed/panel/popup/script/monaco.tsx | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/web/src/nova/ed/panel/popup/script/monaco.tsx b/app/web/src/nova/ed/panel/popup/script/monaco.tsx index 16938ec3..c71f46c5 100644 --- a/app/web/src/nova/ed/panel/popup/script/monaco.tsx +++ b/app/web/src/nova/ed/panel/popup/script/monaco.tsx @@ -150,18 +150,22 @@ export const EdScriptMonaco: FC<{}> = () => { const prop_name = p.ui.popup.script.prop_name; const prop = component.props[prop_name]; if (typeof prop.typings === "string") { - const typings_src = prop.typings.substring( - `const typings = `.length - ); - const typings_fn = new Function( - `return ${typings_src}` - ); - const typings = typings_fn(); - for (const [k, v] of Object.entries(typings)) { - if (typeof v === "string") { - types[k] = v; + try { + const typings_src = prop.typings.substring( + `const typings = `.length + ); + const typings_fn = new Function( + `return ${typings_src}` + ); + const typings = typings_fn(); + if (typeof typings === "object") { + for (const [k, v] of Object.entries(typings)) { + if (typeof v === "string") { + types[k] = v; + } + } } - } + } catch (e) {} } } }