fix monaco

This commit is contained in:
Rizky 2024-04-08 15:23:44 +07:00
parent becd9deff6
commit 7c68f24da4
1 changed files with 4 additions and 3 deletions

View File

@ -147,6 +147,7 @@ export const EdScriptMonaco: FC<{}> = () => {
case "prop-instance": case "prop-instance":
{ {
types._raw = declareScope(p, meta, monaco); types._raw = declareScope(p, meta, monaco);
const nmodel = monaco.editor.createModel( const nmodel = monaco.editor.createModel(
trim(val), trim(val),
"typescript", "typescript",
@ -156,7 +157,8 @@ 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 = component.props[prop_name]; const prop = meta.item.component?.props[prop_name];
if (!!prop && typeof prop.typings === "string") { if (!!prop && typeof prop.typings === "string") {
try { try {
const typings_src = prop.typings.substring( const typings_src = prop.typings.substring(
@ -176,7 +178,6 @@ export const EdScriptMonaco: FC<{}> = () => {
} catch (e) {} } catch (e) {}
} }
} }
} }
break; break;
case "item": case "item":
@ -193,7 +194,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 = meta.item.component?.props[prop_name];
if (!!prop && typeof prop.typings === "string") { if (!!prop && typeof prop.typings === "string") {
const typings_src = prop.typings.substring( const typings_src = prop.typings.substring(
`const typings = `.length `const typings = `.length