From 7c68f24da45d80ea0a03b47321d4b297834fe3c9 Mon Sep 17 00:00:00 2001 From: Rizky Date: Mon, 8 Apr 2024 15:23:44 +0700 Subject: [PATCH] fix monaco --- app/web/src/nova/ed/panel/popup/script/monaco.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 5517635b..35929a77 100644 --- a/app/web/src/nova/ed/panel/popup/script/monaco.tsx +++ b/app/web/src/nova/ed/panel/popup/script/monaco.tsx @@ -147,6 +147,7 @@ export const EdScriptMonaco: FC<{}> = () => { case "prop-instance": { types._raw = declareScope(p, meta, monaco); + const nmodel = monaco.editor.createModel( trim(val), "typescript", @@ -156,7 +157,8 @@ export const EdScriptMonaco: FC<{}> = () => { if (component.id) { const prop_name = p.ui.popup.script.prop_name; - const prop = component.props[prop_name]; + const prop = meta.item.component?.props[prop_name]; + if (!!prop && typeof prop.typings === "string") { try { const typings_src = prop.typings.substring( @@ -176,7 +178,6 @@ export const EdScriptMonaco: FC<{}> = () => { } catch (e) {} } } - } break; case "item": @@ -193,7 +194,7 @@ export const EdScriptMonaco: FC<{}> = () => { if (component.id && meta.jsx_prop?.name) { const prop_name = meta.jsx_prop.name; - const prop = component.props[prop_name]; + const prop = meta.item.component?.props[prop_name]; if (!!prop && typeof prop.typings === "string") { const typings_src = prop.typings.substring( `const typings = `.length