From 6412caff2e3ef3838b53a01d635cd00de27167a0 Mon Sep 17 00:00:00 2001 From: Rizky Date: Tue, 23 Jan 2024 22:56:31 +0700 Subject: [PATCH] wip fix --- app/web/src/nova/ed/panel/popup/script/monaco.tsx | 13 +++++++++++-- .../ed/panel/side/prop-instance/prop-option.tsx | 9 +++++++++ 2 files changed, 20 insertions(+), 2 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 97304985..c485d922 100644 --- a/app/web/src/nova/ed/panel/popup/script/monaco.tsx +++ b/app/web/src/nova/ed/panel/popup/script/monaco.tsx @@ -97,10 +97,19 @@ export const EdScriptMonaco: FC<{}> = () => { } if (p.ui.popup.script.mode === "js") { + const w = window as any; const types: any = {}; - for (const prop of p.global_prop) { - types[prop] = "any"; + for (const prop_name of p.global_prop) { + if (prop_name === "_types") continue; + types[prop_name] = "any"; } + + if (w._types) { + for (const [k, v] of Object.entries(w._types)) { + types[k] = v; + } + } + await monacoTypings( { site_dts: p.site_dts, diff --git a/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx b/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx index b7e586ba..0ba7aed6 100644 --- a/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx +++ b/app/web/src/nova/ed/panel/side/prop-instance/prop-option.tsx @@ -87,6 +87,15 @@ else metaOptions = resOpt; let mode = prop.meta?.option_mode; if (!mode) mode = "button"; + + if (metaOptions && metaOptions.length > 0) { + for (const [k, v] of Object.entries(metaOptions)) { + if (typeof v === "string") { + metaOptions[k as any] = { label: v, value: v }; + } + } + } + return (